Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/lib/utils/contest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ export const classifyContest = (contest_id: string) => {
return null;
};

// HACK: As of June 2025, the following contests are applicable.
// HACK: As of September 2025, the following contests are applicable.
// Note: The classification logic may need to be revised when new contests are added.
const ABC_LIKE: ContestPrefix = {
abl: 'ACL Beginner Contest',
caddi2018b: 'CADDi 2018 for Beginners',
aising2020: 'エイシング プログラミング コンテスト 2020',
hhkb2020: 'HHKB プログラミングコンテスト 2020',
Expand Down Expand Up @@ -123,14 +124,15 @@ const AGC_LIKE: ContestPrefix = {
} as const;
const agcLikePrefixes = getContestPrefixes(AGC_LIKE);

// HACK: As of March 2025, KUPC, UTPC, TTPC and TUPC are included.
// HACK: As of September 2025, KUPC, QUPC, UTPC, TTPC and TUPC are included.
// More university contests may be added in the future.
/**
* Maps university contest ID prefixes to their display names.
*
* @example
* {
* kupc: 'KUPC' // Kyoto University Programming Contest
* qupc: 'QUPC' // Kyushu University Programming Contest
* utpc: 'UTPC' // University of Tokyo Programming Contest
* ttpc: 'TTPC' // Tokyo Institute of Technology Programming Contest
* tupc: 'TUPC' // Tohoku University Programming Contest
Expand All @@ -144,6 +146,7 @@ const agcLikePrefixes = getContestPrefixes(AGC_LIKE);
*/
const ATCODER_UNIVERSITIES: ContestPrefix = {
kupc: 'KUPC',
qupc: 'QUPC',
utpc: 'UTPC',
ttpc: 'TTPC',
tupc: 'TUPC',
Expand Down Expand Up @@ -181,13 +184,15 @@ const ATCODER_OTHERS: ContestPrefix = {
'mujin-pc-2016': 'Mujin Programming Challenge 2016',
'mujin-pc-2018': 'Mujin Programming Challenge 2018',
'tenka1-2015-quala': '天下一プログラマーコンテスト2015予選A',
'tenka1-2015-qualb': '天下一プログラマーコンテスト2015予選B',
'tenka1-2016-final': '天下一プログラマーコンテスト2016本戦',
// Discovery Channel contest featuring algorithm problems
discovery2016: 'DISCO presents ディスカバリーチャンネル プログラミングコンテスト2016',
colopl: 'COLOCON',
gigacode: 'GigaCode',
cpsco2019: 'CPSCO 2019',
'jsc2019-final': '第一回日本最強プログラマー学生選手権決勝',
'jsc2025-final': '第六回日本最強プログラマー学生選手権 -決勝-',
DEGwer2023: 'DEGwer さんの D 論応援コンテスト',
} as const;
const atCoderOthersPrefixes = getContestPrefixes(ATCODER_OTHERS);
Expand Down Expand Up @@ -293,17 +298,18 @@ const regexForAxc = /^(abc|arc|agc)(\d{3})/i;
* Regular expression to match AtCoder University contest identifiers.
*
* The pattern matches strings that:
* - Start with either "ku", "ut", "tt", or "tu"
* - Start with either "ku", "qu", "ut", "tt", or "tu"
* - Followed by "pc"
* - End with exactly year (four digits)
*
* Example matches:
* - "kupc2024"
* - "qupc2018"
* - "utpc2014"
* - "ttpc2022"
* - "tupc2023"
*/
const regexForAtCoderUniversity = /^(ku|ut|tt|tu)(pc)(\d{4})/i;
const regexForAtCoderUniversity = /^(ku|qu|ut|tt|tu)(pc)(\d{4})$/i;

export const getContestNameLabel = (contestId: string) => {
// AtCoder
Expand Down
15 changes: 15 additions & 0 deletions src/test/lib/utils/test_cases/contest_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ export const agc = agcContestIds.map((contestId) =>
);

export const abcLike = [
createTestCaseForContestType('ACL Beginner Contest')({
contestId: 'abl',
expected: ContestType.ABC_LIKE,
}),
createTestCaseForContestType('CADDi 2018 for Beginners')({
contestId: 'caddi2018b',
expected: ContestType.ABC_LIKE,
Expand Down Expand Up @@ -277,6 +281,7 @@ export const agcLike = [

// Note:
// KUPC contests on AtCoder: 2012-2021 and 2024- (not held during 2022-2023)
// QUPC contests on AtCoder: 2014, 2018 (not held during 2015-2017, 2019-)
// UTPC contests on AtCoder: 2011-2014 and 2020-2023 (not held during 2015-2019)
// TTPC contests on AtCoder: 2015, 2019, 2022-
// TUPC contests on AtCoder: 2022-
Expand All @@ -291,6 +296,8 @@ const universityContestIds = [
'kupc2020',
'kupc2021',
'kupc2024',
'qupc2014',
'qupc2018',
'utpc2011',
'utpc2012',
'utpc2013',
Expand Down Expand Up @@ -379,6 +386,10 @@ export const atCoderOthers = [
contestId: 'tenka1-2015-quala',
expected: ContestType.OTHERS,
}),
createTestCaseForContestType('天下一プログラマーコンテスト2015予選B')({
contestId: 'tenka1-2015-qualb',
expected: ContestType.OTHERS,
}),
createTestCaseForContestType('天下一プログラマーコンテスト2016本戦')({
contestId: 'tenka1-2016-final',
expected: ContestType.OTHERS,
Expand Down Expand Up @@ -411,6 +422,10 @@ export const atCoderOthers = [
contestId: 'jsc2019-final',
expected: ContestType.OTHERS,
}),
createTestCaseForContestType('第六回日本最強プログラマー学生選手権 -決勝-')({
contestId: 'jsc2025-final',
expected: ContestType.OTHERS,
}),
createTestCaseForContestType('DEGwer さんの D 論応援コンテスト')({
contestId: 'DEGwer2023',
expected: ContestType.OTHERS,
Expand Down
Loading