NPA's blog

By NPA, 11 years ago, In English

Last round I submitted problem D using cin/cout + ios::sync_with_stdio(false) but it turned out to be too slow (TLE on test 3). Then I try to put cin.tie(0) and got Accepted in 2 seconds. Anyone have any idea why cin.tie(0) is necessary in this case ?

My submissions:

http://codeforces.me/contest/546/submission/11225195

http://codeforces.me/contest/546/submission/11224645

UPD: Explained by rlac and alternative fix by vadimmm in the comment below.

Full text and comments »

Tags c++, io
  • Vote: I like it
  • -15
  • Vote: I do not like it