Блог пользователя TooDumbToWin

Автор TooDumbToWin, история, 10 лет назад, По-английски

I ran these codes in custom invocation and got weird running times.


#include<bits/stdc++.h> using namespace std; int main(){ //Hi for(int i=0;i<5000000;i++)cout<<i<<" "; return 0; }

Run time: 2448 ms


#include<bits/stdc++.h> using namespace std; int main(){ for(int i=0;i<5000000;i++)cout<<i<<" "; return 0; }

Run time: 2901 ms

Can anyone explain why adding comment is having significant impact on running times?

PS: Changing comment affected run time slightly as well.

  • Проголосовать: нравится
  • +32
  • Проголосовать: не нравится

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +24 Проголосовать: не нравится

I guess it should just be difference between each runs. And codeforces caches your submission so if you submit one multiple times, it will return the same result.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

Tried it 8 times. If I change the comment for "Petr" it works.