Meron3r's blog

By Meron3r, history, 6 weeks ago, In English

Why??? You might be asking... well, std::endl is the most common thing that might be giving you TLE. It's because std::endl flushes every time. But on the other hand, '\n' only flushes once every 1000 times because is is just a newline character. But if you are used to writing std::endl or endl, you can just make a define for it. #define endl "\n". If you think I am wrong, just comment, don't dislike.

  • Vote: I like it
  • -18
  • Vote: I do not like it

»
6 weeks ago, # |
  Vote: I like it +7 Vote: I do not like it

It’s rarely to encounter a TLE like that on Codeforces problems. 1207F - Remainder Problem is one such example when the endl really slows things down. But endl has its uses, such as in interactive problems.

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

You're right, but you shouldn't do Define!