Skip to content

Commit

Permalink
Fix penalty
Browse files Browse the repository at this point in the history
  • Loading branch information
kunyavskiy committed Aug 26, 2023
1 parent 25b486e commit b6c6774
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.icpclive.cds.common.jsonLoader
import org.icpclive.cds.settings.AtcoderSettings
import org.icpclive.util.*
import kotlin.time.Duration
import kotlin.time.Duration.Companion.ZERO
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.nanoseconds
import kotlin.time.Duration.Companion.seconds
Expand Down Expand Up @@ -68,6 +69,9 @@ internal class AtcoderDataSource(val settings: AtcoderSettings) : FullReloadCont
while (oldRuns.count { (it.result as? IOIRunResult)?.wrongVerdict != null } < result.Penalty) {
val fst = oldRuns.indexOfFirst { it.result == null }
oldRuns[fst] = oldRuns[fst].copy(result = IOIRunResult(score = listOf(0.0), wrongVerdict = Verdict.Rejected))
if (result.Elapsed.nanoseconds != ZERO && oldRuns[fst].time > result.Elapsed.nanoseconds) {
oldRuns[fst] = oldRuns[fst].copy(time = result.Elapsed.nanoseconds)
}
}
if (result.Score > 0) {
if (oldRuns.mapNotNull { it.result as? IOIRunResult }.maxOfOrNull { it.score[0] }?.toInt() != result.Score / 100 && !result.Pending) {
Expand Down

0 comments on commit b6c6774

Please sign in to comment.