Please read the new rule regarding the restriction on the use of AI tools. ×

Killua_Supremacy's blog

By Killua_Supremacy, history, 4 years ago, In English

how precomputation works in spoj as my solution for FOURCHIPS(HARD) got accepted however it was taking around 9 second for precomputation and then just constant time for rest of testcases, however the final verdict was 2 sec.i dont know how that works??

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

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

I too faced this problem. Sometimes the timelimit says 1sec and our accepted solution shows time as 5sec...

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I think SPOJ shows you the total time needed for all test cases and not time per test that's why you get times greater than the time limit.

    Regarding the original question maybe while testing your code you had compiler optimizations disabled for debugging purposes and that explains why it took you 9 seconds and SPOJ 2 seconds. Compiler optimizations makes a big difference

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

      Yeah finally figured it,its just difference between my laptop and spoj cluster. By the way i used to think that it takes average in precomputation calculation around different test however its not that,its just like codeforces where time per test is given not testcase and so Total time=precomputation+(testcasesnumber*timeforonetestcase)