@xcpcio/core 0.2.1

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.
@@ -0,0 +1,162 @@
1
+ import dayjs from 'dayjs';
2
+ export { default as dayjs } from 'dayjs';
3
+ import { SubmissionStatus, Submission as Submission$1, Submissions as Submissions$1, BalloonColor, Problem as Problem$1, Problems as Problems$1, StatusTimeDisplay, Image, ContestState, Contest as Contest$1, Team as Team$1, Teams as Teams$1 } from '@xcpcio/types';
4
+
5
+ declare function createDayJS(time?: Date | string | number | undefined): dayjs.Dayjs;
6
+ declare function getTimestamp(time: number | dayjs.Dayjs): number;
7
+ declare function getTimeDiff(seconds: number): string;
8
+
9
+ declare class Submission {
10
+ id: string;
11
+ teamId: string;
12
+ problemId: string;
13
+ timestamp: number;
14
+ status: SubmissionStatus;
15
+ isIgnore: boolean;
16
+ constructor();
17
+ isAccepted(): boolean;
18
+ isRejected(): boolean;
19
+ isPending(): boolean;
20
+ isNotCalculatedPenaltyStatus(): boolean;
21
+ static compare(lhs: Submission, rhs: Submission): number;
22
+ }
23
+ type Submissions = Array<Submission>;
24
+ declare function createSubmission(submissionJSON: Submission$1): Submission;
25
+ declare function createSubmissions(submissionsJSON: Submissions$1): Submissions;
26
+
27
+ interface ProblemStatistics {
28
+ acceptedNum: number;
29
+ rejectedNum: number;
30
+ pendingNum: number;
31
+ submittedNum: number;
32
+ }
33
+ declare class Problem {
34
+ id: string;
35
+ label: string;
36
+ name: string;
37
+ timeLimit?: string;
38
+ memoryLimit?: string;
39
+ balloonColor?: BalloonColor;
40
+ statistics: ProblemStatistics;
41
+ constructor();
42
+ }
43
+ type Problems = Array<Problem>;
44
+ declare function createProblem(problemJSON: Problem$1): Problem;
45
+ declare function createProblems(problemsJSON: Problems$1): Problems;
46
+ declare function createProblemsByProblemIds(problemIds: string[], balloonColors?: BalloonColor[]): Problems;
47
+ declare class TeamProblemStatistics {
48
+ isFirstSolved: boolean;
49
+ isSolved: boolean;
50
+ solvedTimestamp: number;
51
+ isSubmitted: boolean;
52
+ lastSubmitTimestamp: number;
53
+ failedCount: number;
54
+ pendingCount: number;
55
+ ignoreCount: number;
56
+ totalCount: number;
57
+ submissions: Submissions;
58
+ problem: Problem;
59
+ contestPenalty: number;
60
+ constructor(options?: {
61
+ teamProblemStatistics?: TeamProblemStatistics;
62
+ });
63
+ get isAccepted(): boolean;
64
+ get isWrongAnswer(): boolean;
65
+ get isPending(): boolean;
66
+ get isUnSubmitted(): boolean;
67
+ get penalty(): number;
68
+ }
69
+
70
+ declare class Contest {
71
+ name: string;
72
+ startTime: dayjs.Dayjs;
73
+ endTime: dayjs.Dayjs;
74
+ freezeTime: dayjs.Dayjs;
75
+ totalDurationTimestamp: number;
76
+ freezeDurationTimestamp: number;
77
+ unFreezeDurationTimestamp: number;
78
+ penalty: number;
79
+ problems: Problems;
80
+ problemsMap: Map<string, Problem>;
81
+ statusTimeDisplay: StatusTimeDisplay;
82
+ badge?: string;
83
+ medal?: Record<string, Record<string, number>>;
84
+ organization?: string;
85
+ group?: Record<string, string>;
86
+ tag?: Record<string, string>;
87
+ logo?: Image;
88
+ banner?: Image;
89
+ boardLink?: string;
90
+ version: string;
91
+ constructor();
92
+ getContestDuration(timeFormat?: string): string;
93
+ getContestState(): ContestState;
94
+ getContestPendingTime(): string;
95
+ getContestRemainingTime(endTime: dayjs.Dayjs): string;
96
+ getContestElapsedTime(): string;
97
+ getContestProgressRatio(): number;
98
+ }
99
+ declare function createContest(contestJSON: Contest$1): Contest;
100
+
101
+ declare function getImageSource(image: Image): string;
102
+
103
+ declare class Team {
104
+ id: string;
105
+ name: string;
106
+ organization: string;
107
+ group: Array<string>;
108
+ tag: Array<string>;
109
+ coach?: string | Array<string>;
110
+ members?: string | Array<string>;
111
+ rank: number;
112
+ solvedProblemNum: number;
113
+ penalty: number;
114
+ problemStatistics: Array<TeamProblemStatistics>;
115
+ problemStatisticsMap: Map<string, TeamProblemStatistics>;
116
+ constructor();
117
+ penaltyToMinute(): number;
118
+ calcSolvedData(): void;
119
+ static compare(lhs: Team, rhs: Team): number;
120
+ }
121
+ type Teams = Array<Team>;
122
+ declare function createTeam(teamJSON: Team$1): Team;
123
+ declare function createTeams(teamsJSON: Teams$1): Teams;
124
+
125
+ declare class Rank {
126
+ readonly contest: Contest;
127
+ teams: Teams;
128
+ teamsMap: Map<string, Team>;
129
+ submissions: Submissions;
130
+ submissionsMap: Map<string, Submission>;
131
+ firstSolvedSubmissions: Map<string, Submissions>;
132
+ constructor(contest: Contest, teams: Teams, submissions: Submissions);
133
+ buildRank(options?: {
134
+ timestamp?: number;
135
+ }): this;
136
+ }
137
+
138
+ declare class ResolverOperation {
139
+ id: number;
140
+ team: Team;
141
+ problemIx: number;
142
+ beforeTeamProblemStatistics: TeamProblemStatistics;
143
+ afterTeamProblemStatistics: TeamProblemStatistics;
144
+ constructor();
145
+ }
146
+
147
+ declare class Resolver extends Rank {
148
+ finalRank: Rank;
149
+ operations: Array<ResolverOperation>;
150
+ beforeFreezeSubmissions: Submissions;
151
+ afterFreezeSubmissions: Submissions;
152
+ constructor(contest: Contest, teams: Teams, submissions: Submissions);
153
+ buildResolver(): void;
154
+ }
155
+
156
+ declare function stringToSubmissionStatus(status: string): SubmissionStatus;
157
+ declare function isAccepted(status: SubmissionStatus): boolean;
158
+ declare function isRejected(status: SubmissionStatus): boolean;
159
+ declare function isPending(status: SubmissionStatus): boolean;
160
+ declare function isNotCalculatedPenaltyStatus(status: SubmissionStatus): boolean;
161
+
162
+ export { Contest, Problem, ProblemStatistics, Problems, Rank, Resolver, Submission, Submissions, Team, TeamProblemStatistics, Teams, createContest, createDayJS, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, stringToSubmissionStatus };