aberent's blog

By aberent, history, 3 years ago, In English

Is the checker occasionally failing to detect that a test has completed, and so giving a TLE?

In Codeforces round 727 problem C, when the system tests were run, I got TLE on my submission on test 18. Looking at the results my code printed the result before getting the TLE, and my code should exit immediately after printing the result. At first I assumed that I was just unlucky, and my code had taken precisely one second to run, so had been stopped just before exiting.

After the contest I tried modifying my code in various ways to speed it up, for example https://codeforces.me/contest/1539/submission/120193428 and https://codeforces.me/contest/1539/submission/120195587. In all cases I got exactly the same result; my code printed an answer but still got a TLE. It seems extremely unlikely that every single version of my code would take precisely 1 second to run.

To confirm this, I tried running my most recent version under Python3 instead of PyPy3. This is normally slower, but on this occasion passed all tests without any TLEs. See https://codeforces.me/contest/1539/submission/120195637

Full text and comments »

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

By aberent, history, 4 years ago, In English

I have been trying to get my Python solution to Lamps in a Circle (Codeforces Global problem 8) to work. I was getting runtime errors on test 6, so I put in some code to print the error. On doing so my solution was accepted.

The accepted solution is https://codeforces.me/contest/1368/submission/84398375, the rejected one is https://codeforces.me/contest/1368/submission/84398296. The only difference is the code to catch the exception.

I initially saw this with PyPy3, but I get the same behaviour with Python 3.

Does anybody have any ideas on why this is happening?

Full text and comments »

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