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??
I too faced this problem. Sometimes the timelimit says 1sec and our accepted solution shows time as 5sec...
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
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)