DOMjudge / domjudge

DOMjudge programming contest jury system
https://www.domjudge.org
GNU General Public License v2.0
732 stars 256 forks source link

The first solved is not calculated for some case #2281

Open tossy310 opened 10 months ago

tossy310 commented 10 months ago

Description of the problem

DOMjudge is unable to calculate first solved data correctly in a specific case described below.

Recalculation (Refresh scoreboard cache from jury UI) can recalculates correctly, but it'd be great if DOMjudge can handle this case.

Your environment

Any of DOMjudge 8.2.1, 8.2.2, 2cd74e91c35122ad1eae325520e573c71b11a032 (using docker-contributor image on Ubuntu 22.04)

Steps to reproduce

If the following happens in this order for a specific problem, the first solved is not calculated:

  1. Team A submits a solution.
  2. Team B submits a solution.
  3. Team B's solution is returned as accepted. At this point, Team A's solution is still under judging.
  4. Team A's solution is returned as incorrect.

At the point of returning the result of Team B (step 3), the first solved cannot be determined. However, once the Team A's submission is returned (at step 4), because there's no pending submission that was submitted before the Team B's submission, the Team B's submission is expected to be marked as the first solved.

For local testing, it's easy to reproduce this by extending timelimit of a problem longer (e.g. 60 seconds) and submitting a TLE solution as a team A's one.

Expected behaviour

Once the Team B's solution can be determined as the first solved, then the scoreboard shows it.

Actual behaviour

The first solved is still N/A even after the first solved can be determined.

Requesting recalculation of the scoreboard fixes it.

eldering commented 10 months ago

This sounds very similar to #2105. Is this already fixed in main @nickygerritsen ?

nickygerritsen commented 10 months ago

Seems not since @tossy310 tested it there as well. We should investigate

tossy310 commented 10 months ago

Yes, I've tested on the HEAD of main, and the issue exists there as well.

If I read code correctly, the problem is that this part of code

https://github.com/DOMjudge/domjudge/blob/2cd74e91c35122ad1eae325520e573c71b11a032/webapp/src/Service/ScoreboardService.php#L417-L467

is responsible to update first-to-solve, but this is called only for the corresponding team's submission. (except recalculation of the cache).

https://github.com/DOMjudge/domjudge/pull/527 (an old PR) changed logics around here, and it prevents updating first-to-solve at step 3 in my reproduction step, but it didn't add any logic to recalculate first-to-solve at step 4 in the step.

nickygerritsen commented 10 months ago

I opened a PR with a potential fix. Thanks for finding this!

vmcj commented 2 months ago

I think I wrongly reopend this.

tossy310 commented 2 months ago

Looking at #2361, the commit was reverted. Are there any followup commit that actually fixed this?

Thanks!

(Just a note, this bug is what actually happened in last year's ICPC Japan Yokohama rehearsal contest.)

vmcj commented 2 months ago

Ok, that explains why we re-opened it.

I'll discuss this with the team.