Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

ghorardim's blog

By ghorardim, history, 7 years ago, In English

I had solved this problem.Time limit of this problem is 1 sec.After complete of my all calculation I had run a big nested loop and submit that.Then I had surprised!!!I got AC and the execution time of that code as same as my real code. How it is possible??? Why I didn't get TLE?? Why the execution time as same as my real code??

Please anyone help me............

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

| Write comment?
»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Probably the compiler optimises away the loop because it detects that you are not actually doing any work inside that loop.

»
7 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

The compiler is optimizing your code. Check this submission:

http://codeforces.com/contest/486/submission/29111856

So, yes, the compiler is optimizing the mega big loop.

This is your code with only one change: now all variables are volatile. If a variable is volatile then the compiler won't optimize any code which involves this variable. This is useful on bigger programs where you are certain that compiler optimizations may not take into account things like external acceses and similar things.