RaidenEi's blog

By RaidenEi, history, 8 years ago, In English

I saw this submission of problem 678A - Johny Likes Numbers and tried to hack it with case n=1000000000 and k=1.

18417780

It passes within the problem's time limit 0.5s, but I thought it should be a TLE (I tested on ideone and it runs about 0.91s). I can't think of any reason but CF judge is really fast. Any other ideas?

  • Vote: I like it
  • -23
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it +1 Vote: I do not like it

I noticed it depends — some solutions like this get hacked with the same tests, some not, I'm wondering why it is like that too.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it -38 Vote: I do not like it

    Of what I have heard, the setter of the problem can choose the cluster where his problems shall be executed...And these clusters vary in speed...In the previous educational round I could not think of a solution taking less than 10^8 iterations, So I read the editorial..and then I found out that the most appropriate solution was the one which took 10^8 iterations...

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      But I've never expected such a cluster can run about 10^9 iterations in just half of a second...

»
8 years ago, # |
  Vote: I like it +8 Vote: I do not like it

This link might help.

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

It's because of the compiler optimization. I ran the code on my computer. It took 2.1 seconds to run when compiled without -02 flag, but it took 0.3 seconds with the flag.

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

have you tried this submission in Custom Invocation tab (the last tab after Standing) it's shows you Running Time on CodeForces System , it's necessary tool when you gonna hack using TLE failure

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thank you, this will be one of my most important lessons when trying to hack someone's solution.