Skip to content

Commit 354b763

Browse files
committed
Fix scoring contest scoreboard
Fixes two problems: - Teams are sorted correctly when they have a solved problem, even if they didn't score any points (i.e. last solution time used as timebreaker). - Conversion to RELTIMEs for 2026-01 was broken: scoreboard row wasn't converted back from ms to min and problem data wasn't rounded. Fixed in Result so that penalty & time are always rounded to minutes for both pass/fail and scoring contests. Fixes icpctools#1294.
1 parent 1e7e4fb commit 354b763

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

ContestModel/src/org/icpc/tools/contest/model/ContestUtil.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ public static long getTimeInMin(long timeMs) {
8484
return timeMs / 60000L;
8585
}
8686

87+
public static long roundTimeToMin(long timeMs) {
88+
return timeMs / 60000L * 60000L;
89+
}
90+
8791
/**
8892
* Format contest time as a string.
8993
*

ContestModel/src/org/icpc/tools/contest/model/internal/Contest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import java.util.Set;
1414

1515
import org.icpc.tools.contest.Trace;
16-
import org.icpc.tools.contest.model.ContestUtil;
1716
import org.icpc.tools.contest.model.IAccount;
1817
import org.icpc.tools.contest.model.IAward;
1918
import org.icpc.tools.contest.model.IClarification;
@@ -1046,8 +1045,8 @@ private void calculateResultsAndStandings() {
10461045
for (int j = 0; j < numProblems; j++) {
10471046
penalty += tempResults[i][j].getPenaltyTime();
10481047
if (tempResults[i][j].getStatus() == Status.SOLVED) {
1049-
long time = ContestUtil.getTimeInMin(tempResults[i][j].getContestTime());
1050-
penalty += time * (60 * 1000L);
1048+
long time = tempResults[i][j].getContestTime();
1049+
penalty += time;
10511050
numSolved++;
10521051
score += tempResults[i][j].getScore();
10531052
if (time > lastSolution)
@@ -1058,7 +1057,7 @@ private void calculateResultsAndStandings() {
10581057
double scoreForThisProblem = tempResults[i][j].getScore();
10591058
if (scoreForThisProblem > 0) {
10601059
score += scoreForThisProblem;
1061-
long time = ContestUtil.getTimeInMin(tempResults[i][j].getContestTime()) * 60 * 1000L;
1060+
long time = tempResults[i][j].getContestTime();
10621061
if (time > lastSolution)
10631062
lastSolution = time;
10641063
}

ContestModel/src/org/icpc/tools/contest/model/internal/Ranking.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ else if (si.getLastSolutionTime() == sj.getLastSolutionTime()) {
7979
if (si.getScore() < sj.getScore())
8080
swap = true;
8181
else if (si.getScore() == sj.getScore()) {
82-
if (si.getLastSolutionTime() > sj.getLastSolutionTime())
82+
if ((sj.getLastSolutionTime() >= 0 && si.getLastSolutionTime() < 0)
83+
|| (sj.getLastSolutionTime() >= 0 && si.getLastSolutionTime() > sj.getLastSolutionTime())) {
8384
swap = true;
84-
else if (si.getLastSolutionTime() == sj.getLastSolutionTime()) {
85+
} else if (si.getLastSolutionTime() == sj.getLastSolutionTime()) {
8586
String tin = teams[order[i]].getActualDisplayName();
8687
String tjn = teams[order[j]].getActualDisplayName();
8788
if (tin != null && tjn != null && collator.compare(tin, tjn) > 0)

ContestModel/src/org/icpc/tools/contest/model/internal/Result.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package org.icpc.tools.contest.model.internal;
22

3+
import org.icpc.tools.contest.model.ContestUtil;
4+
import org.icpc.tools.contest.model.IContest.ScoreboardType;
35
import org.icpc.tools.contest.model.IJudgement;
46
import org.icpc.tools.contest.model.IJudgementType;
5-
import org.icpc.tools.contest.model.IContest.ScoreboardType;
67
import org.icpc.tools.contest.model.IProblem;
78
import org.icpc.tools.contest.model.IResult;
89
import org.icpc.tools.contest.model.ISubmission;
@@ -76,7 +77,7 @@ protected void addSubmission(Contest contest, ISubmission s, IJudgement j, IJudg
7677
if (j.getScore() > score) {
7778
score = j.getScore();
7879
numJudged++;
79-
time = s.getContestTime();
80+
time = ContestUtil.roundTimeToMin(s.getContestTime());
8081
}
8182
}
8283
}
@@ -104,7 +105,7 @@ protected void addSubmission(Contest contest, ISubmission s, IJudgement j, IJudg
104105
} // else compile or judgement error that doesn't count as an attempt or penalty
105106
}
106107

107-
time = s.getContestTime();
108+
time = ContestUtil.roundTimeToMin(s.getContestTime());
108109

109110
}
110111

0 commit comments

Comments
 (0)