Skip to content

Commit 22b9310

Browse files
authored
Merge pull request #1525 from AtCoder-NoviSteps/#1524
✨ Add tasks for TTPC (#1524)
2 parents 81d80f0 + c0eb913 commit 22b9310

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

src/lib/utils/contest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ const agcLikePrefixes = getContestPrefixes(AGC_LIKE);
116116
* @example
117117
* {
118118
* utpc: 'UTPC' // University of Tokyo Programming Contest
119+
* ttpc: 'TTPC' // Tokyo Institute of Technology Programming Contest
119120
* tupc: 'TUPC' // Tohoku University Programming Contest
120121
* }
121122
*
@@ -127,6 +128,7 @@ const agcLikePrefixes = getContestPrefixes(AGC_LIKE);
127128
*/
128129
const ATCODER_UNIVERSITIES: ContestPrefix = {
129130
utpc: 'UTPC',
131+
ttpc: 'TTPC',
130132
tupc: 'TUPC',
131133
} as const;
132134

src/test/lib/utils/test_cases/contest_name_and_task_index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,29 @@ const UTPC_TEST_DATA: UniversityContestsTestData = Object.fromEntries(
251251
]),
252252
) as UniversityContestsTestData;
253253

254+
type TtpcYear = '2015' | '2019' | '2022' | '2023';
255+
type TtpcTaskPatterns = {
256+
[K in TtpcYear]: string[];
257+
};
258+
259+
const TTPC_TASK_PATTERNS: TtpcTaskPatterns = {
260+
'2015': ['A', 'B', 'C', 'N', 'O', 'P'],
261+
'2019': ['A', 'B', 'C', 'M', 'N', 'O'],
262+
'2022': ['A', 'B', 'C', 'M', 'N', 'O'],
263+
'2023': ['A', 'B', 'C', 'N', 'O', 'P'],
264+
};
265+
266+
const TTPC_YEARS = [2015, 2019, 2022, 2023];
267+
const TTPC_TEST_DATA: UniversityContestsTestData = Object.fromEntries(
268+
TTPC_YEARS.map((year) => [
269+
`ttpc${year}`,
270+
{
271+
contestId: `ttpc${year}`,
272+
tasks: TTPC_TASK_PATTERNS[year.toString() as keyof TtpcTaskPatterns],
273+
},
274+
]),
275+
) as UniversityContestsTestData;
276+
254277
type TupcYear = '2022' | '2023';
255278
type TupcTaskPatterns = {
256279
[K in TupcYear]: string[];
@@ -290,6 +313,7 @@ const generateUniversityTestCases = (
290313

291314
const ALL_UNIVERSITY_TEST_DATA: UniversityContestsTestData = {
292315
...UTPC_TEST_DATA,
316+
...TTPC_TEST_DATA,
293317
...TUPC_TEST_DATA,
294318
};
295319

src/test/lib/utils/test_cases/contest_name_labels.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ const generateUtpcTestCases = (
263263
return testCase;
264264
});
265265
};
266+
const generateTtpcTestCases = (
267+
years: number[],
268+
): { name: string; value: TestCaseForContestNameLabel }[] => {
269+
return years.map((year) => {
270+
const testCase = createTestCaseForContestNameLabel(`TTPC ${year}`)({
271+
contestId: `ttpc${year}`,
272+
expected: `TTPC${year}`,
273+
});
274+
275+
return testCase;
276+
});
277+
};
266278
const generateTupcTestCases = (
267279
years: number[],
268280
): { name: string; value: TestCaseForContestNameLabel }[] => {
@@ -278,12 +290,14 @@ const generateTupcTestCases = (
278290

279291
// Note:
280292
// UTPC contests on AtCoder: 2011-2014 and 2020-2023 (not held during 2015-2019)
293+
// TTPC contests on AtCoder: 2015, 2019, 2022-
281294
// TUPC contests on AtCoder: 2022-
282295
//
283296
// See:
284297
// https://kenkoooo.com/atcoder/resources/contests.json
285298
export const universities = [
286299
...generateUtpcTestCases([2011, 2012, 2013, 2014, 2020, 2021, 2022, 2023]),
300+
...generateTtpcTestCases([2015, 2019, 2022, 2023]),
287301
...generateTupcTestCases([2022, 2023]),
288302
];
289303

src/test/lib/utils/test_cases/contest_type.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ export const agcLike = [
213213

214214
// Note:
215215
// UTPC contests on AtCoder: 2011-2014 and 2020-2023 (not held during 2015-2019)
216+
// TTPC contests on AtCoder: 2015, 2019, 2022-
216217
// TUPC contests on AtCoder: 2022-
217218
//
218219
// See:
@@ -226,6 +227,10 @@ const universityContestIds = [
226227
'utpc2021',
227228
'utpc2022',
228229
'utpc2023',
230+
'ttpc2015',
231+
'ttpc2019',
232+
'ttpc2022',
233+
'ttpc2023',
229234
'tupc2022',
230235
'tupc2023',
231236
];

0 commit comments

Comments
 (0)