By taap_cader, history, 5 months ago,

Sometimes when I do question of around 10^7 operations, I don't need to use fast io but the questions which can be solved with 10^5 operations gets TLE without using fast io. Is there some trick to guess when do we need to use fast io or it we have to use it in every question.

• -17

 » 5 months ago, # |   +19 Use it always anyway.
•  » » 5 months ago, # ^ |   0 But be careful during interactive problems.
 » 5 months ago, # |   +3 Use it always!!
 » 5 months ago, # | ← Rev. 3 →   +9 What do you mean by "fast io"?If you mean some customized input implemented with getchar, it's almost never needed. I've never seen a problem on Codeforces needing this.If you mean scanf vs cin, my suggestion is to always use scanf. On online judges running on Linux, cin with ios::sync_with_stdio(false) and cin.tie(0) is slightly faster (it's not a typo) than scanf. But Codeforces is on Windows so I'm not sure, and scanf is almost always fast enough.If you mean other languages (than C++), I can't give any advice since I don't know.
•  » » 5 months ago, # ^ |   +15 I just take a look at the OP's submissions. I think he/she gets TLE on large number of operations because he/she used endl everywhere.Don't use it — it does not give any advantage in competitive programming, but just slows down the output. Use plain '\n'.I'm very annoyed by the fact that many C++ teachers implies to the student to use endl, without even telling what it is.