Weird behavior of judge: my program gives "participants answer" correctly, but TLE

Revision en1, by hamko, 2016-06-30 03:48:10

I have 2 questions about the following 2 submission. The difference between these is only using asynchronous cin (I mean cin with cin.tie(0); ios::sync_with_stdio(false);) or using scanf.

TLE http://codeforces.net/contest/688/submission/18812536

Accepted http://codeforces.net/contest/688/submission/18812173

1) Why the TLE submission gives "participants answer" correctly, but TLE?

2) I thought the speed of an asynchronous cin input method is comparative to scanf. However, scanf was over 200 ms faster than asynchronous cin. the input size is only 1 million. Why these two have so different spending time?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English hamko 2016-06-30 03:48:10 704 Initial revision (published)