-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Article on common I/O optimizations #903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It would be part of #388, if that one becomes reality. Other than that attempt at a translation, we don't have any C++ tutorial / guideline at all. And there are lots of other C++ related topics, that could add. E.g. when to use map/unordered map, policy-based data structures, interactive problems, those tricks like including I'm open to adding those to the site, if somebody takes the effort and writing up articles. |
What about having this short article for now and maybe expanding it to C++ in CP later? That's a quite broad topic |
Sure, why not. |
Also I've heard that including |
I'm generally in favor of using |
Portability I mean some people on Windows may be using Microsoft compiler or clang on other platforms. Anyway I digress on those code-saving tricks |
I've also come across some people using |
I occasionally use Another caveat is that on some compilers it might require you to use twice as much memory when you don't need it or make your execution time slower, so one should wary of using it in time/memory critical environment. Other than that, my personal opinion is it's fine to use the define, as long as you understand what you're doing. P.S. Do I understand correctly that you're working on the article on this topic right now? |
Thanks for your response. I can quickly whip up an article just to have some info on it |
There was a pull request with this in #939, but @adamsoltan withdrew it... |
If the old PR is not going to be revived, I can whip up a quick article |
Should psychological tips be added too? Like in an Um_Nik blog: stop worrying about rating, stop obsessing over saving time typing, master the fundamentals before learning advanced data structures which don't appear in Div2 and 3 contests https://codeforces.com/blog/entry/92248 |
It's well-known for competition programming in C++ to use the following simple I/O optimizations:
ios_base::sync_with_stdio(false)
which shouldn't ever be a problem as you shouldn't use C I/O in c++ evercin.tie(0)
(except for maybe interactive problems)(they should be prefixed with
std::
but competition programmers use namespace std which is bad style but probably ok for cp)Here's an ancient Dr Dobbs article on it https://www.drdobbs.com/the-standard-librarian-iostreams-and-std/184401305
also https://codeforces.com/blog/entry/6251
Should this be its own article? So we have a convenient reference instead of tracking down CF blogs.
The text was updated successfully, but these errors were encountered: