Skip to content

Commit 11f90d1

Browse files
authored
Merge pull request #1873 from AtCoder-NoviSteps/#1866
✨ Add tasks (#1866)
2 parents 02e19e3 + 794cc1a commit 11f90d1

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

src/lib/utils/contest.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,14 @@ const AGC_LIKE: ContestPrefix = {
118118
} as const;
119119
const agcLikePrefixes = getContestPrefixes(AGC_LIKE);
120120

121-
// HACK: As of November 2024, UTPC, TTPC and TUPC are included.
121+
// HACK: As of March 2025, KUPC, UTPC, TTPC and TUPC are included.
122122
// More university contests may be added in the future.
123123
/**
124124
* Maps university contest ID prefixes to their display names.
125125
*
126126
* @example
127127
* {
128+
* kupc: 'KUPC' // Kyoto University Programming Contest
128129
* utpc: 'UTPC' // University of Tokyo Programming Contest
129130
* ttpc: 'TTPC' // Tokyo Institute of Technology Programming Contest
130131
* tupc: 'TUPC' // Tohoku University Programming Contest
@@ -137,6 +138,7 @@ const agcLikePrefixes = getContestPrefixes(AGC_LIKE);
137138
* 3. Ensure prefix doesn't conflict with existing contest types
138139
*/
139140
const ATCODER_UNIVERSITIES: ContestPrefix = {
141+
kupc: 'KUPC',
140142
utpc: 'UTPC',
141143
ttpc: 'TTPC',
142144
tupc: 'TUPC',
@@ -164,6 +166,7 @@ const ATCODER_OTHERS: ContestPrefix = {
164166
chokudai_S: 'Chokudai SpeedRun',
165167
'code-festival-2014-qualb': 'Code Festival 2014 予選 B',
166168
'code-festival-2014-final': 'Code Festival 2014 決勝',
169+
'code-festival-2015-morning-middle': 'CODE FESTIVAL 2015 あさぷろ Middle',
167170
'code-thanks-festival': 'CODE THANKS FESTIVAL',
168171
donuts: 'Donutsプロコンチャレンジ',
169172
indeednow: 'Indeedなう',
@@ -280,16 +283,17 @@ const regexForAxc = /^(abc|arc|agc)(\d{3})/i;
280283
* Regular expression to match AtCoder University contest identifiers.
281284
*
282285
* The pattern matches strings that:
283-
* - Start with either "ut", "tt", or "tu"
286+
* - Start with either "ku", "ut", "tt", or "tu"
284287
* - Followed by "pc"
285288
* - End with exactly year (four digits)
286289
*
287290
* Example matches:
291+
* - "kupc2024"
288292
* - "utpc2014"
289293
* - "ttpc2022"
290294
* - "tupc2023"
291295
*/
292-
const regexForAtCoderUniversity = /^(ut|tt|tu)(pc)(\d{4})/i;
296+
const regexForAtCoderUniversity = /^(ku|ut|tt|tu)(pc)(\d{4})/i;
293297

294298
export const getContestNameLabel = (contestId: string) => {
295299
// AtCoder

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,39 @@ interface UniversityContestsTestData {
412412
}
413413

414414
// Note:
415+
// KUPC contests on AtCoder: 2012-2021 and 2024- (not held during 2022-2023)
415416
// UTPC contests on AtCoder: 2011-2014 and 2020-2023 (not held during 2015-2019)
416417
// TTPC contests on AtCoder: 2015, 2019, 2022-
417418
// TUPC contests on AtCoder: 2022-
418419
//
419420
// See:
420421
// https://kenkoooo.com/atcoder/resources/contests.json
422+
type KupcYear = '2012' | '2013' | '2014' | '2019' | '2020' | '2021' | '2024';
423+
type KupcTaskPatterns = {
424+
[K in KupcYear]: string[];
425+
};
426+
427+
const KUPC_TASK_PATTERNS: KupcTaskPatterns = {
428+
'2012': ['A', 'B', 'C', 'G', 'H', 'I'],
429+
'2013': ['A', 'B', 'C', 'I', 'J', 'K'],
430+
'2014': ['A', 'B', 'C', 'J', 'K', 'L'],
431+
'2019': ['A', 'B', 'C', 'J', 'K', 'L'],
432+
'2020': ['A', 'B', 'C', 'K', 'L', 'M'],
433+
'2021': ['A', 'B', 'C', 'K', 'L', 'M'],
434+
'2024': ['A', 'B', 'C', 'N', 'O', 'P'],
435+
};
436+
437+
const KUPC_YEARS = [2012, 2013, 2014, 2019, 2020, 2021, 2024];
438+
const KUPC_TEST_DATA: UniversityContestsTestData = Object.fromEntries(
439+
KUPC_YEARS.map((year) => [
440+
`kupc${year}`,
441+
{
442+
contestId: `kupc${year}`,
443+
tasks: KUPC_TASK_PATTERNS[year.toString() as keyof KupcTaskPatterns],
444+
},
445+
]),
446+
) as UniversityContestsTestData;
447+
421448
type UtpcTaskPatterns = {
422449
'2011-2014': string[];
423450
'2020': string[];
@@ -510,6 +537,7 @@ const generateUniversityTestCases = (
510537
};
511538

512539
const ALL_UNIVERSITY_TEST_DATA: UniversityContestsTestData = {
540+
...KUPC_TEST_DATA,
513541
...UTPC_TEST_DATA,
514542
...TTPC_TEST_DATA,
515543
...TUPC_TEST_DATA,

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,21 @@ export const agcLike = [
256256
];
257257

258258
// Note:
259+
// KUPC contests on AtCoder: 2012-2021 and 2024- (not held during 2022-2023)
259260
// UTPC contests on AtCoder: 2011-2014 and 2020-2023 (not held during 2015-2019)
260261
// TTPC contests on AtCoder: 2015, 2019, 2022-
261262
// TUPC contests on AtCoder: 2022-
262263
//
263264
// See:
264265
// https://kenkoooo.com/atcoder/resources/contests.json
265266
const universityContestIds = [
267+
'kupc2012',
268+
'kupc2013',
269+
'kupc2014',
270+
'kupc2019',
271+
'kupc2020',
272+
'kupc2021',
273+
'kupc2024',
266274
'utpc2011',
267275
'utpc2012',
268276
'utpc2013',
@@ -303,6 +311,10 @@ export const atCoderOthers = [
303311
contestId: 'code-festival-2014-final',
304312
expected: ContestType.OTHERS,
305313
}),
314+
createTestCaseForContestType('CODE FESTIVAL 2015 あさぷろ Middle')({
315+
contestId: 'code-festival-2015-morning-middle',
316+
expected: ContestType.OTHERS,
317+
}),
306318
createTestCaseForContestType('CODE THANKS FESTIVAL 2017')({
307319
contestId: 'code-thanks-festival-2017',
308320
expected: ContestType.OTHERS,

0 commit comments

Comments
 (0)