@icpctools/contest-api 0.0.0-stage → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +134 -2
- package/dist/contest-api.d.ts +120 -0
- package/dist/contest-api.js +795 -0
- package/dist/contest-api.js.map +1 -0
- package/dist/contest-time-util.d.ts +24 -0
- package/dist/contest-time-util.js +182 -0
- package/dist/contest-time-util.js.map +1 -0
- package/dist/contest-types.d.ts +315 -0
- package/dist/contest-types.js +12 -0
- package/dist/contest-types.js.map +1 -0
- package/dist/contest-util.d.ts +21 -0
- package/dist/contest-util.js +195 -0
- package/dist/contest-util.js.map +1 -0
- package/dist/contests.d.ts +16 -0
- package/dist/contests.js +72 -0
- package/dist/contests.js.map +1 -0
- package/dist/fetch-utils.d.ts +2 -0
- package/dist/fetch-utils.js +14 -0
- package/dist/fetch-utils.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -3
- package/src/contest-api.ts +924 -0
- package/src/contest-time-util.ts +219 -0
- package/src/contest-types.ts +381 -0
- package/src/contest-util.ts +230 -0
- package/src/contests.ts +78 -0
- package/src/fetch-utils.ts +18 -0
- package/src/index.ts +5 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright later.
|
|
3
|
+
*/
|
|
4
|
+
import type { Contest, ContestState, RelTime } from './contest-types.js';
|
|
5
|
+
|
|
6
|
+
function isNumber(value: unknown): value is number {
|
|
7
|
+
return typeof value === 'number';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function parseRelTime(relTime: RelTime | number | undefined): number | undefined {
|
|
11
|
+
if (!relTime) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
if (isNumber(relTime)) {
|
|
15
|
+
// times were in minutes, but we want ms
|
|
16
|
+
return relTime * 60 * 1000;
|
|
17
|
+
}
|
|
18
|
+
const match = relTime.match('-?([0-9]+):([0-9]{2}):([0-9]{2})(\\.[0-9]{3})?');
|
|
19
|
+
|
|
20
|
+
if (!match || match.length < 4) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const h = parseInt(match[1]);
|
|
25
|
+
const m = parseInt(match[2]);
|
|
26
|
+
const s = parseInt(match[3]);
|
|
27
|
+
let ms = 0;
|
|
28
|
+
if (match[4]) {
|
|
29
|
+
ms = parseInt(match[4].substring(1));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const ret = h * 60 * 60 * 1000 + m * 60 * 1000 + s * 1000 + ms;
|
|
33
|
+
if (relTime.startsWith('-')) {
|
|
34
|
+
return -ret;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return ret;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function timeToMin(relTime: RelTime | number | undefined): string {
|
|
41
|
+
if (!relTime) {
|
|
42
|
+
return '';
|
|
43
|
+
}
|
|
44
|
+
return formatTimeInMin(parseRelTime(relTime));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function formatTimeInMin(timeMs: number | undefined): string {
|
|
48
|
+
if (!timeMs) {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
if (timeMs >= 0 && timeMs < 1000) {
|
|
52
|
+
return '0';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const sb = [];
|
|
56
|
+
if (timeMs < 0) {
|
|
57
|
+
sb.push('-');
|
|
58
|
+
timeMs = -timeMs;
|
|
59
|
+
}
|
|
60
|
+
const timeS = Math.floor(timeMs / 1000);
|
|
61
|
+
|
|
62
|
+
const mins = Math.floor(timeS / 60.0);
|
|
63
|
+
if (mins > 0) {
|
|
64
|
+
sb.push(mins);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return sb.join('');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Returns the current contest time:
|
|
72
|
+
* - undefined if the contest isn't scheduled
|
|
73
|
+
* - negative if we're before the scheduled start, or countdown is paused
|
|
74
|
+
* - positive once the contest has been started (taking removed intervals and multiplier into account)
|
|
75
|
+
* - continues past contest duration if the contest is over
|
|
76
|
+
*/
|
|
77
|
+
export function getContestTime(contest?: Contest, state?: ContestState, currentTimeMs?: number): number | undefined {
|
|
78
|
+
if (!contest) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// paused
|
|
83
|
+
const m = contest?.time_multiplier ?? 1;
|
|
84
|
+
if (contest.countdown_pause_time) {
|
|
85
|
+
const pause = parseRelTime(contest.countdown_pause_time);
|
|
86
|
+
if (!pause) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return -pause * m;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// not started
|
|
94
|
+
const currentTime = currentTimeMs ?? Date.now();
|
|
95
|
+
if (!state?.started) {
|
|
96
|
+
if (!contest.start_time) {
|
|
97
|
+
return undefined;
|
|
98
|
+
} else {
|
|
99
|
+
// scheduled
|
|
100
|
+
const d = new Date(contest.start_time);
|
|
101
|
+
return (currentTime - d.getTime()) * m;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// started - apply removed intervals
|
|
106
|
+
let removedTime = 0;
|
|
107
|
+
if (state.removed_intervals) {
|
|
108
|
+
for (const interval of state.removed_intervals) {
|
|
109
|
+
const intervalStart = new Date(interval.start).getTime();
|
|
110
|
+
if (intervalStart < currentTime) {
|
|
111
|
+
// interval started before now, so it applies
|
|
112
|
+
if (!interval.end) {
|
|
113
|
+
// we're in the interval
|
|
114
|
+
return parseRelTime(interval.contest_time) ?? 0;
|
|
115
|
+
}
|
|
116
|
+
const intervalEnd = new Date(interval?.end).getTime();
|
|
117
|
+
if (intervalEnd > currentTime) {
|
|
118
|
+
// we're in the interval
|
|
119
|
+
return parseRelTime(interval.contest_time) ?? 0;
|
|
120
|
+
}
|
|
121
|
+
removedTime += intervalEnd - intervalStart;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const d = new Date(state.started);
|
|
127
|
+
return (currentTime - d.getTime() - removedTime) * m;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Returns the current time remaining in the contest:
|
|
132
|
+
* - undefined if there's no contest or it doesn't have a valid duration
|
|
133
|
+
* - the contest duration if it hasn't started yet
|
|
134
|
+
* - a positive, decreasing number if the contest is running (taking removed intervals and multiplier into account)
|
|
135
|
+
* - zero once the contest is over
|
|
136
|
+
* Use formatContestTime(x, true) for user formatting.
|
|
137
|
+
*/
|
|
138
|
+
export function getRemainingContestTime(
|
|
139
|
+
contest?: Contest,
|
|
140
|
+
state?: ContestState,
|
|
141
|
+
currentTimeMs?: number
|
|
142
|
+
): number | undefined {
|
|
143
|
+
if (!contest || !contest.duration) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const duration = parseRelTime(contest.duration);
|
|
148
|
+
if (!duration) {
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (!state?.started) {
|
|
153
|
+
return duration;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (state?.ended) {
|
|
157
|
+
return 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// started - apply removed intervals
|
|
161
|
+
const currentTime = currentTimeMs ?? Date.now();
|
|
162
|
+
let removedTime = 0;
|
|
163
|
+
if (state.removed_intervals) {
|
|
164
|
+
for (const interval of state.removed_intervals) {
|
|
165
|
+
const intervalStart = new Date(interval.start).getTime();
|
|
166
|
+
if (intervalStart < currentTime) {
|
|
167
|
+
// interval started before now, so it applies
|
|
168
|
+
if (!interval.end) {
|
|
169
|
+
// we're in the interval
|
|
170
|
+
return duration - (parseRelTime(interval.contest_time) ?? 0);
|
|
171
|
+
}
|
|
172
|
+
const intervalEnd = new Date(interval?.end).getTime();
|
|
173
|
+
if (intervalEnd > currentTime) {
|
|
174
|
+
// we're in the interval
|
|
175
|
+
return duration - (parseRelTime(interval.contest_time) ?? 0);
|
|
176
|
+
}
|
|
177
|
+
removedTime += intervalEnd - intervalStart;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const d = new Date(state.started);
|
|
183
|
+
return Math.max(0, duration - (currentTime - d.getTime() - removedTime) * (contest?.time_multiplier ?? 1));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function formatContestTime(time: number | undefined, ceil?: boolean): string | undefined {
|
|
187
|
+
if (time === undefined) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const sb = [];
|
|
192
|
+
if (time < 0) {
|
|
193
|
+
sb.push('-');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const ss = Math.abs(ceil ? Math.ceil(time / 1000.0) : Math.floor(time / 1000.0));
|
|
197
|
+
|
|
198
|
+
const days = Math.floor(ss / 86400.0);
|
|
199
|
+
|
|
200
|
+
if (days > 0) {
|
|
201
|
+
sb.push(days + 'd ');
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const hours = Math.floor(ss / 3600.0) % 24;
|
|
205
|
+
sb.push(hours + ':');
|
|
206
|
+
|
|
207
|
+
const minutes = Math.floor(ss / 60) % 60;
|
|
208
|
+
if (minutes < 10) {
|
|
209
|
+
sb.push('0');
|
|
210
|
+
}
|
|
211
|
+
sb.push(minutes + ':');
|
|
212
|
+
|
|
213
|
+
const seconds = ss % 60;
|
|
214
|
+
if (seconds < 10) {
|
|
215
|
+
sb.push('0');
|
|
216
|
+
}
|
|
217
|
+
sb.push(seconds);
|
|
218
|
+
return sb.join('');
|
|
219
|
+
}
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contest API Types
|
|
3
|
+
*
|
|
4
|
+
* AUTO-GENERATED by scripts/merge-types.ts - DO NOT EDIT
|
|
5
|
+
*
|
|
6
|
+
* This file is merged from the spec-version-specific contest-types-*.ts files.
|
|
7
|
+
* It includes types from the 2023-06, 2026-01, 2026-01-next Contest API specifications,
|
|
8
|
+
* and ICPC Tools extensions.
|
|
9
|
+
* Inline comments are used to indicate objects and properties that are unique to any of these.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export type ContestType =
|
|
13
|
+
| 'version'
|
|
14
|
+
| 'access'
|
|
15
|
+
| 'contest'
|
|
16
|
+
| 'judgement-types'
|
|
17
|
+
| 'languages'
|
|
18
|
+
| 'problems'
|
|
19
|
+
| 'groups'
|
|
20
|
+
| 'organizations'
|
|
21
|
+
| 'teams'
|
|
22
|
+
| 'persons'
|
|
23
|
+
| 'account'
|
|
24
|
+
| 'accounts'
|
|
25
|
+
| 'state'
|
|
26
|
+
| 'submissions'
|
|
27
|
+
| 'judgements'
|
|
28
|
+
| 'runs'
|
|
29
|
+
| 'clarifications'
|
|
30
|
+
| 'awards'
|
|
31
|
+
| 'commentary'
|
|
32
|
+
| 'scoreboard'
|
|
33
|
+
| 'map-info'
|
|
34
|
+
| 'start-status';
|
|
35
|
+
|
|
36
|
+
export type Id = string;
|
|
37
|
+
|
|
38
|
+
export type RelTime = string;
|
|
39
|
+
|
|
40
|
+
export type Time = string;
|
|
41
|
+
|
|
42
|
+
export interface Provider {
|
|
43
|
+
name: string;
|
|
44
|
+
version?: string;
|
|
45
|
+
logo?: FileReference[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface Version {
|
|
49
|
+
version: string;
|
|
50
|
+
version_url: string;
|
|
51
|
+
provider?: Provider;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface Access {
|
|
55
|
+
capabilities: string[];
|
|
56
|
+
endpoints: Endpoint[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface Endpoint {
|
|
60
|
+
type: string;
|
|
61
|
+
properties: string[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface Location {
|
|
65
|
+
latitude: number;
|
|
66
|
+
longitude: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface Contest {
|
|
70
|
+
id: Id;
|
|
71
|
+
name: string;
|
|
72
|
+
formal_name?: string;
|
|
73
|
+
start_time?: string;
|
|
74
|
+
countdown_pause_time?: RelTime;
|
|
75
|
+
duration: RelTime;
|
|
76
|
+
scoreboard_freeze_duration?: RelTime;
|
|
77
|
+
scoreboard_thaw_time?: Time;
|
|
78
|
+
scoreboard_type: 'pass-fail' | 'score';
|
|
79
|
+
penalty_time?: number | RelTime; // 2023-06 | 2026-01 spec
|
|
80
|
+
main_scoreboard_group_id?: Id; // 2026-01
|
|
81
|
+
banner?: FileReference[];
|
|
82
|
+
logo?: FileReference[];
|
|
83
|
+
location?: Location;
|
|
84
|
+
time_multiplier?: number; // ICPC Tools
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface FileReference {
|
|
88
|
+
href: string;
|
|
89
|
+
filename: string;
|
|
90
|
+
mime: string;
|
|
91
|
+
hash?: string;
|
|
92
|
+
width?: number;
|
|
93
|
+
height?: number;
|
|
94
|
+
tags?: string[]; // 2026-01
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface ContestState {
|
|
98
|
+
started?: Time;
|
|
99
|
+
frozen?: Time;
|
|
100
|
+
ended?: Time;
|
|
101
|
+
thawed?: Time;
|
|
102
|
+
finalized?: Time;
|
|
103
|
+
end_of_updates?: Time;
|
|
104
|
+
removed_intervals?: RemovedInterval[]; // 2026-01-next
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface TeamLocation {
|
|
108
|
+
x: number;
|
|
109
|
+
y: number;
|
|
110
|
+
rotation: number;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface Team {
|
|
114
|
+
id: Id;
|
|
115
|
+
icpc_id?: string;
|
|
116
|
+
label: string;
|
|
117
|
+
name: string;
|
|
118
|
+
display_name?: string;
|
|
119
|
+
organization_id?: string;
|
|
120
|
+
group_ids?: string[];
|
|
121
|
+
hidden?: boolean; // 2023-06
|
|
122
|
+
photo?: FileReference[];
|
|
123
|
+
video?: FileReference[];
|
|
124
|
+
backup?: FileReference[];
|
|
125
|
+
key_log?: FileReference[];
|
|
126
|
+
tool_data?: FileReference[];
|
|
127
|
+
desktop?: FileReference[];
|
|
128
|
+
webcam?: FileReference[];
|
|
129
|
+
audio?: FileReference[];
|
|
130
|
+
location?: TeamLocation;
|
|
131
|
+
primary_rgb?: string; // 2026-01-next
|
|
132
|
+
primary_color?: string; // 2026-01-next
|
|
133
|
+
secondary_rgb?: string; // 2026-01-next
|
|
134
|
+
secondary_color?: string; // 2026-01-next
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface Problem {
|
|
138
|
+
id: Id;
|
|
139
|
+
uuid?: string;
|
|
140
|
+
label: string;
|
|
141
|
+
name: string;
|
|
142
|
+
ordinal: number;
|
|
143
|
+
rgb?: string;
|
|
144
|
+
color?: string;
|
|
145
|
+
time_limit: number;
|
|
146
|
+
test_data_count: number;
|
|
147
|
+
max_score?: number;
|
|
148
|
+
package?: FileReference[];
|
|
149
|
+
statement?: FileReference[];
|
|
150
|
+
memory_limit?: number; // 2026-01
|
|
151
|
+
output_limit?: number; // 2026-01
|
|
152
|
+
code_limit?: number; // 2026-01
|
|
153
|
+
attachments?: FileReference[]; // 2026-01
|
|
154
|
+
location?: FloorLocation; // ICPC Tools
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface Group {
|
|
158
|
+
id: Id;
|
|
159
|
+
icpc_id?: string;
|
|
160
|
+
name: string;
|
|
161
|
+
type?: string;
|
|
162
|
+
location?: Location;
|
|
163
|
+
logo?: FileReference[]; // ICPC Tools
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface Organization {
|
|
167
|
+
id: Id;
|
|
168
|
+
icpc_id?: string;
|
|
169
|
+
name: string;
|
|
170
|
+
formal_name?: string;
|
|
171
|
+
country?: string;
|
|
172
|
+
country_flag?: FileReference[];
|
|
173
|
+
country_subdivision?: string; // 2026-01
|
|
174
|
+
country_subdivision_flag?: FileReference[]; // 2026-01
|
|
175
|
+
twitter_hashtag?: string;
|
|
176
|
+
twitter_account?: string;
|
|
177
|
+
url?: string;
|
|
178
|
+
logo?: FileReference[];
|
|
179
|
+
location?: Location;
|
|
180
|
+
audio?: FileReference[]; // ICPC Tools
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface Submission {
|
|
184
|
+
id: Id;
|
|
185
|
+
language_id: Id;
|
|
186
|
+
problem_id: Id;
|
|
187
|
+
team_id?: Id;
|
|
188
|
+
account_id?: Id; // 2026-01
|
|
189
|
+
time: Time;
|
|
190
|
+
contest_time: RelTime;
|
|
191
|
+
entry_point?: string;
|
|
192
|
+
files: FileReference[];
|
|
193
|
+
reaction?: FileReference[];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface JudgementType {
|
|
197
|
+
id: Id;
|
|
198
|
+
simplified_judgement_type_id?: Id; // 2026-01
|
|
199
|
+
name: string;
|
|
200
|
+
penalty: boolean;
|
|
201
|
+
solved: boolean;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface Language {
|
|
205
|
+
id: Id;
|
|
206
|
+
name: string;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface Person {
|
|
210
|
+
id: Id;
|
|
211
|
+
icpc_id?: string;
|
|
212
|
+
name: string;
|
|
213
|
+
team_ids?: Id[]; // 2023-06
|
|
214
|
+
title?: string; // 2023-06
|
|
215
|
+
email?: string;
|
|
216
|
+
sex?: string | 'male' | 'female'; // 2023-06 | 2026-01-next spec
|
|
217
|
+
roles?: PersonRole[]; // 2026-01-next
|
|
218
|
+
role?: 'contestant' | 'coach' | 'staff' | 'other'; // 2023-06
|
|
219
|
+
photo?: FileReference[];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface Scoreboard {
|
|
223
|
+
time: Time;
|
|
224
|
+
contest_time: RelTime;
|
|
225
|
+
state: ContestState;
|
|
226
|
+
rows: ScoreboardRow[];
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface ScoreboardScore {
|
|
230
|
+
num_solved?: number;
|
|
231
|
+
score?: number;
|
|
232
|
+
time?: number | RelTime; // 2023-06 | 2026-01 spec
|
|
233
|
+
total_time?: number | RelTime; // 2023-06 | 2026-01 spec
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface ScoreboardRow {
|
|
237
|
+
rank: number;
|
|
238
|
+
team_id: Id;
|
|
239
|
+
score: ScoreboardScore;
|
|
240
|
+
problems?: ScoreboardProblem[];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export interface ScoreboardProblem {
|
|
244
|
+
problem_id: Id;
|
|
245
|
+
num_judged: number;
|
|
246
|
+
num_pending: number;
|
|
247
|
+
solved?: boolean;
|
|
248
|
+
score?: number;
|
|
249
|
+
time?: number | RelTime; // 2023-06 | 2026-01 spec
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface Judgement {
|
|
253
|
+
id: Id;
|
|
254
|
+
submission_id: Id;
|
|
255
|
+
judgement_type_id?: Id;
|
|
256
|
+
simplified_judgement_type_id?: Id; // 2026-01
|
|
257
|
+
score?: number;
|
|
258
|
+
current?: boolean; // 2026-01
|
|
259
|
+
start_time: Time;
|
|
260
|
+
start_contest_time?: RelTime; // 2023-06
|
|
261
|
+
end_time?: Time;
|
|
262
|
+
end_contest_time?: RelTime; // 2023-06
|
|
263
|
+
max_run_time?: number;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export interface Run {
|
|
267
|
+
id: Id;
|
|
268
|
+
judgement_id: Id;
|
|
269
|
+
ordinal: number;
|
|
270
|
+
judgement_type_id: Id;
|
|
271
|
+
time: Time;
|
|
272
|
+
contest_time?: RelTime; // 2023-06
|
|
273
|
+
run_time: number;
|
|
274
|
+
score?: number; // 2026-01-next
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface Account {
|
|
278
|
+
id: Id;
|
|
279
|
+
username: string;
|
|
280
|
+
password?: string;
|
|
281
|
+
name?: string;
|
|
282
|
+
type: 'team' | 'judge' | 'admin' | 'analyst' | 'staff' | 'coach'; // 2023-06 | 2026-01-next spec
|
|
283
|
+
ip?: string;
|
|
284
|
+
team_id?: Id;
|
|
285
|
+
person_id?: Id;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface Clarification {
|
|
289
|
+
id: Id;
|
|
290
|
+
from_team_id?: Id;
|
|
291
|
+
to_team_ids?: Id[]; // 2026-01
|
|
292
|
+
to_group_ids?: Id[]; // 2026-01
|
|
293
|
+
to_team_id?: Id; // 2023-06
|
|
294
|
+
reply_to_id?: Id;
|
|
295
|
+
problem_id?: Id;
|
|
296
|
+
text: string;
|
|
297
|
+
time: Time;
|
|
298
|
+
contest_time: RelTime;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface Commentary {
|
|
302
|
+
id: Id;
|
|
303
|
+
time: Time;
|
|
304
|
+
contest_time: RelTime;
|
|
305
|
+
message: string;
|
|
306
|
+
tags: string[];
|
|
307
|
+
source_id?: Id;
|
|
308
|
+
team_ids?: Id[];
|
|
309
|
+
problem_ids?: Id[];
|
|
310
|
+
submission_ids?: Id[];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export interface Award {
|
|
314
|
+
id: Id;
|
|
315
|
+
citation: string;
|
|
316
|
+
team_ids?: Id[];
|
|
317
|
+
display_mode?: string; // ICPC Tools
|
|
318
|
+
parameters?: AwardParameters; // ICPC Tools
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface Notification {
|
|
322
|
+
type: ContestType;
|
|
323
|
+
id?: Id;
|
|
324
|
+
data?: { id: Id }[] | object;
|
|
325
|
+
token?: string;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// 2026-01-next
|
|
329
|
+
export interface RemovedInterval {
|
|
330
|
+
start: Time;
|
|
331
|
+
end?: Time;
|
|
332
|
+
contest_time: RelTime;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// 2026-01-next
|
|
336
|
+
export interface PersonRole {
|
|
337
|
+
type: 'contestant' | 'coach' | 'staff' | 'other';
|
|
338
|
+
title?: string;
|
|
339
|
+
team_id?: Id;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// ICPC Tools
|
|
343
|
+
export interface MapInfo {
|
|
344
|
+
table_width: number;
|
|
345
|
+
table_depth: number;
|
|
346
|
+
team_area_width: number;
|
|
347
|
+
team_area_depth: number;
|
|
348
|
+
aisles?: Aisle[];
|
|
349
|
+
spare_teams?: TeamLocation[];
|
|
350
|
+
printer?: FloorLocation;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// ICPC Tools
|
|
354
|
+
export interface Aisle {
|
|
355
|
+
x1: number;
|
|
356
|
+
y1: number;
|
|
357
|
+
x2: number;
|
|
358
|
+
y2: number;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// ICPC Tools
|
|
362
|
+
export interface FloorLocation {
|
|
363
|
+
x: number;
|
|
364
|
+
y: number;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// ICPC Tools
|
|
368
|
+
export interface AwardParameters {
|
|
369
|
+
numTeams?: number;
|
|
370
|
+
solvedTop?: number;
|
|
371
|
+
solvedBottom?: number;
|
|
372
|
+
percentileTop?: number;
|
|
373
|
+
percentileBottom?: number;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// ICPC Tools
|
|
377
|
+
export interface StartStatus {
|
|
378
|
+
id: Id;
|
|
379
|
+
label: string;
|
|
380
|
+
status: 0 | 1 | 2;
|
|
381
|
+
}
|