strange_voice's blog

By strange_voice, 9 years ago, In English

Hi everybody.

I have a question. I tried to solve the problem A.123-sequence but each time it got "Time Limit exceeded on test 18". even I submitted the answer of one of my friends (ATofighi) that got "Accepted" to see that does the compiler do right? but it got "Time limit exceeded on test 18", too!!!!now I add the link of all the submissions below.

http://codeforces.com/contest/52/submission/12923012

http://codeforces.com/contest/52/submission/12923040

http://codeforces.com/contest/52/submission/12923066

http://codeforces.com/contest/52/submission/12923078

http://codeforces.com/contest/52/submission/12923091

http://codeforces.com/contest/52/submission/12923108

and these links are the links of my friend and my submissions(my friend got "Accepted" and when I submitted the same code it get "Time limit exceeded on test 18")

http://codeforces.com/contest/52/submission/4798391 "Accepted"

http://codeforces.com/contest/52/submission/12923117 "Time limit exceeded on test 18"

http://codeforces.com/contest/52/submission/4798427 "Accepted"

http://codeforces.com/contest/52/submission/12923121 "Time limit exceeded on test 18"

http://codeforces.com/contest/52/submission/4798425 "Accepted"

http://codeforces.com/contest/52/submission/12923130 "Time limit exceeded on test 18"

Thank you so much for your help.

UPD:Thank slycelote so much for his/her help .finally I get "Accepted".

http://codeforces.com/contest/52/submission/12957204

UPD2:If you have same problems I suggest that see this post too.It can be helpful for you.

http://codeforces.com/blog/entry/20262

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

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

Codeforces servers were upgraded some time between 2013 and now. Running time for old programs is calculated in this way to account for faster servers:

Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, than value 800 ms will be displayed and used to determine the verdict.

But it's obviously not a precise method, and also compilers have been upgraded since then. So old programs may change from AC to TL or vice versa.

As for why you get a TL — probably because of inefficient I/O. Use this:

    ios_base::sync_with_stdio(0);
    cin.tie(0);
  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Your right but if you see the runnig time of my friend's code, it's 592 ms and if you multiply it by 2 it get 1184 ms but my running time is 2000 ms and I get "time limit" . Why does it happen?? How do you think?