add contest rank.

This commit is contained in:
2023-02-09 20:23:11 +08:00
parent 6f5a4d7e66
commit 5f39ec4fd2
9 changed files with 243 additions and 23 deletions

View File

@@ -65,6 +65,16 @@ export function duration(start: Date, end: Date): string {
return result
}
export function secondsToDuration(seconds: number): string {
const epoch = new Date(0)
const secondsAfterEpoch = new Date(seconds * 1000)
const duration = intervalToDuration({
start: epoch,
end: secondsAfterEpoch,
})
return [duration.hours, duration.minutes, duration.seconds].join(":")
}
export function submissionMemoryFormat(memory: number | string | undefined) {
if (memory === undefined) return "--"
// 1048576 = 1024 * 1024