Order of including headers seems to affect overall running time.

Правка en2, от dotorya, 2017-04-04 17:36:25

I wrote two different codes, which differs only on order of headers. Two codes are like these:

#include <stdio.h>
#include <algorithm>
....(blahblah)....

2.


#include <algorithm> #include <stdio.h> ....(blahblah)....

Note: At (blahblah) part, there are 9 millions scanf("%d", &t) operations. Compilation options are both GNU C++14. (GNU C++14 6.2.0, which is used on Codeforces.)

For my opinion, this two code should exactly do the same operations.

But, 1st code gives 1.6ms / 2ms AC, and 2nd code gives TLE. This issue is not about server status, it's still same during many submits.

Can someone help me about what's going on here?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский dotorya 2017-04-04 17:51:30 47 Tiny change: 'g on here?' -> 'g on here?\n\nNote : It's not 1.6ms / 2ms, It's 1.6s / 2s'
en2 Английский dotorya 2017-04-04 17:36:25 38
en1 Английский dotorya 2017-04-04 17:35:40 726 Initial revision (published)