Execution time do not makes sense

I’m having difficulties resolving a very simple problem. My solution is optimal (for sure), but I’m still getting the error time limit exceed.

In order to known how far I’m for the correct solution, I decided to uploaded different versions of my algorithm that only solves a portion of the test cases (an return 0 for the other test cases). In that way, I get a wrong answer response which tells me how many time took my algorithm for resolve the selected test cases:

  • First test: the algorithm resolves the first half of the test cases, the Time is 0.04
  • Second test: the algorithm resolves the second half of the test cases, the Time is 0.04
  • Third test: the algorithm resolves the 90% of the test cases, the Time is still 0.04

If the Time limit is 1 second, then how is that I’m getting a “time limit exceed” error, considering that my algorithm seems to solve the test case in, at most, 0.05 seconds?

just 1 suggestion…try to run ur code on ideone.com !!! and enter the worst case input…considering the highest constraints…and see if it runs in time…and make sure that ur code is made private there…and pls make on account to access ur code again…hope this helps…:slight_smile:

I have no idea, how are you test it (I got lost in those percents)…

…it seems like there is something wrong at the end of your code…

…maybe you have some unexpected (for judge) getchar() at the end, so your code won’t finish, because judge won’t have additional char at the end…

It seems that the problem is that the 1 second limit is for executing one file and CodeChef test the solutions with several files.

So the 0.04 time that I’m getting is the time for executing the first file. The time limit exceed exception is probably thrown when the “n” file is being tested over my algorithm.