NotStack's blog

By NotStack, history, 9 hours ago, In English

I noticed that after system testing, Codeforces reruns all the solutions submitted after the round, and this process takes hours. I’m curious—why is this necessary?

Wouldn't it be more efficient to check the database to see if a solution was already accepted or marked wrong instead of re-evaluating everything? Running all solutions again is a heavy task that puts unnecessary load on the server, slowing down Codeforces significantly.

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

»
9 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Well, sometimes, during contests, because of the huge number of people, solutions pass even though they aren't technically supposed to. Usually, these are cases where solutions normally TLE or MLE, but they pass during the contest.

»
8 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Some of it is cuz of hacking. After the contest, all solutions are re-run, but with all the successful hacks also being included. This way if someone was not directly hacked by someone but still had the same mistakes as a hacked person, their code will fail the re-run.

  • »
    »
    8 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    There's hacking, but also something more important. In-contest solutions are only run on pre-tests. I believe this is so that the contest runs smoothly. Anyway, after the contest, all the sols are re-run with all of the system tests, this fully checks out the solutions, and sometimes, sols that passed the pre-tests fail the system tests. Usually the contest writers try to account for everything in the pre-tests though.

»
8 hours ago, # |
  Vote: I like it +6 Vote: I do not like it

Are you referring to system testing that takes place after a Div. 3 or Educational Round?

If so, after the hacking phase concludes, the system re-evaluates all solutions using the newly added test cases.

»
8 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I think that feature in specific is very useful when the contest have pretests.

In certain contest you don't get the AC directly, you get pretests passed and I suppose that it was implemented to increase performance during the contest, it's better run all the cases in batch after the contest instead that run it in contest.

For the contests that doesn't have the pretests feature, the system testing refers the last submissions that are in queue and need to be tested.

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I'm talking about, if a person submits the solution after the contest, just for the practice purpose. Then in this case, it again re runs after finishing the system testing.

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

During a contest, only a few pretests a run so that the server can handle the thousands of in-contest submissions. One thing I have noticed, however, is that some problems have 100s of test cases even when only 10 or so are needed to account for all edge cases. 90% of test cases do not fail a single solution, so they are basically useless.