0-jij-0's blog

By 0-jij-0, 6 years ago, In English

Hello everyone,

I've noticed in the last contest (Codeforces Round 632 (Div. 2)) many people including me had this issue in 1333D - Challenges in school №41 where our verdicts changed from TLE to AC by just changing every "endl" to '\n'.

TLE Submission: 75902058

AC Submission: 75903554

I knew before that "endl" does some flushing business and this usually takes (Maybe I'm wrong) time but I knew also that the following lines disable this thing: (Maybe I'm also wrong)

ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);

But I still got an issue using "endl" so can someone explain if possible how does endl work exactly and what do the lines above change about using cin/cout/endl?

Thank you!

  • Vote: I like it
  • +10
  • Vote: I do not like it

| Write comment?
»
6 years ago, hide # |
 
Vote: I like it +59 Vote: I do not like it

ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); does not stop endl from flushing