Skip to content

Commit ff1b1b5

Browse files
authored
Merge pull request #1591 from AtCoder-NoviSteps/#1589
✨ Add tasks for ABC-like (#1589)
2 parents e2529c3 + 34fb64e commit ff1b1b5

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

src/lib/utils/contest.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ export const classifyContest = (contest_id: string) => {
5656
return ContestType.MATH_AND_ALGORITHM;
5757
}
5858

59+
if (abcLikePrefixes.has(contest_id)) {
60+
return ContestType.ABC_LIKE;
61+
}
62+
5963
if (arcLikePrefixes.has(contest_id)) {
6064
return ContestType.ARC_LIKE;
6165
}
@@ -88,8 +92,13 @@ export const classifyContest = (contest_id: string) => {
8892
return null;
8993
};
9094

91-
// HACK: As of early November 2024, the following contests are applicable.
95+
// HACK: As of December 2024, the following contests are applicable.
9296
// Note: The classification logic may need to be revised when new contests are added.
97+
const ABC_LIKE: ContestPrefix = {
98+
panasonic2020: 'パナソニックプログラミングコンテスト 2020',
99+
} as const;
100+
const abcLikePrefixes = new Set(getContestPrefixes(ABC_LIKE));
101+
93102
const ARC_LIKE: ContestPrefix = {
94103
'tenka1-2018': 'Tenka1 Programmer Contest 2018',
95104
'dwacon5th-prelims': '第5回 ドワンゴからの挑戦状 予選',

src/test/lib/utils/contest.test.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,23 @@ describe('Contest', () => {
123123
});
124124
});
125125

126-
describe('when contest_id mean arc-like', () => {
126+
describe('when contest_id means abc-like', () => {
127+
TestCasesForContestType.abcLike.forEach(({ name, value }) => {
128+
runTests(`${name}`, [value], ({ contestId, expected }: TestCaseForContestType) => {
129+
expect(classifyContest(contestId)).toEqual(expected);
130+
});
131+
});
132+
});
133+
134+
describe('when contest_id means arc-like', () => {
127135
TestCasesForContestType.arcLike.forEach(({ name, value }) => {
128136
runTests(`${name}`, [value], ({ contestId, expected }: TestCaseForContestType) => {
129137
expect(classifyContest(contestId)).toEqual(expected);
130138
});
131139
});
132140
});
133141

134-
describe('when contest_id mean agc-like', () => {
142+
describe('when contest_id means agc-like', () => {
135143
TestCasesForContestType.agcLike.forEach(({ name, value }) => {
136144
runTests(`${name}`, [value], ({ contestId, expected }: TestCaseForContestType) => {
137145
expect(classifyContest(contestId)).toEqual(expected);
@@ -289,6 +297,14 @@ describe('Contest', () => {
289297
});
290298
});
291299

300+
describe('when contest_id means abc-like', () => {
301+
TestCasesForContestType.abcLike.forEach(({ name, value }) => {
302+
runTests(`${name}`, [value], ({ contestId, expected }: TestCaseForContestType) => {
303+
expect(getContestPriority(contestId)).toEqual(contestTypePriorities.get(expected));
304+
});
305+
});
306+
});
307+
292308
describe('when contest_id means arc-like', () => {
293309
TestCasesForContestType.arcLike.forEach(({ name, value }) => {
294310
runTests(`${name}`, [value], ({ contestId, expected }: TestCaseForContestType) => {

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ export const agc = agcContestIds.map((contestId) =>
186186
}),
187187
);
188188

189+
export const abcLike = [
190+
createTestCaseForContestType('Panasonic 2020')({
191+
contestId: 'panasonic2020',
192+
expected: ContestType.ABC_LIKE,
193+
}),
194+
];
195+
189196
export const arcLike = [
190197
createTestCaseForContestType('Tenka1 2018')({
191198
contestId: 'tenka1-2018',

0 commit comments

Comments
 (0)