Skip to content

Commit 8ee6d95

Browse files
committed
feat: Add table for AWC (#3153)
1 parent 1ff332a commit 8ee6d95

File tree

13 files changed

+482
-34
lines changed

13 files changed

+482
-34
lines changed

prisma/ERD.md

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ AGC AGC
2525
ABC_LIKE ABC_LIKE
2626
ARC_LIKE ARC_LIKE
2727
AGC_LIKE AGC_LIKE
28+
AWC AWC
2829
UNIVERSITY UNIVERSITY
2930
FPS_24 FPS_24
3031
OTHERS OTHERS
@@ -205,28 +206,19 @@ OTHERS OTHERS
205206
DateTime updatedAt
206207
}
207208
208-
"user" o|--|| "Roles" : "enum:role"
209-
"user" o{--}o "session" : ""
210-
"user" o{--}o "key" : ""
211-
"user" o{--}o "taskanswer" : ""
212-
"user" o{--}o "workbook" : ""
213-
"session" o|--|| "user" : "user"
214-
"key" o|--|| "user" : "user"
215-
"task" o|--|| "ContestType" : "enum:contest_type"
216-
"task" o|--|| "TaskGrade" : "enum:grade"
217-
"task" o|--|| "AtcoderProblemsDifficulty" : "enum:atcoder_problems_difficulty"
218-
"task" o{--}o "tasktag" : ""
219-
"task" o{--}o "taskanswer" : ""
220-
"task" o{--}o "workbooktask" : ""
221-
"tag" o{--}o "tasktag" : ""
222-
"tasktag" o|--|o "task" : "task"
223-
"tasktag" o|--|o "tag" : "tag"
224-
"taskanswer" o|--|o "task" : "task"
225-
"taskanswer" o|--|o "user" : "user"
226-
"taskanswer" o|--|o "submissionstatus" : "status"
227-
"workbook" o|--|| "WorkBookType" : "enum:workBookType"
228-
"workbook" o|--|| "user" : "user"
229-
"workbook" o{--}o "workbooktask" : ""
230-
"workbooktask" o|--|| "workbook" : "workBook"
231-
"workbooktask" o|--|| "task" : "task"
209+
"user" |o--|| "Roles" : "enum:role"
210+
"session" }o--|| user : "user"
211+
"key" }o--|| user : "user"
212+
"task" |o--|| "ContestType" : "enum:contest_type"
213+
"task" |o--|| "TaskGrade" : "enum:grade"
214+
"task" |o--|| "AtcoderProblemsDifficulty" : "enum:atcoder_problems_difficulty"
215+
"tasktag" }o--|o task : "task"
216+
"tasktag" }o--|o tag : "tag"
217+
"taskanswer" }o--|o task : "task"
218+
"taskanswer" }o--|o user : "user"
219+
"taskanswer" }o--|o submissionstatus : "status"
220+
"workbook" |o--|| "WorkBookType" : "enum:workBookType"
221+
"workbook" }o--|| user : "user"
222+
"workbooktask" }o--|| workbook : "workBook"
223+
"workbooktask" }o--|| task : "task"
232224
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterEnum
2+
ALTER TYPE "ContestType" ADD VALUE 'AWC';

prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ enum ContestType {
237237
ABC_LIKE // AtCoder Beginner Contest (ABC) 相当のコンテスト
238238
ARC_LIKE // AtCoder Regular Contest (ARC) 相当のコンテスト
239239
AGC_LIKE // AtCoder Grand Contest (AGC) 相当のコンテスト
240+
AWC // AtCoder Weekday Contest
240241
UNIVERSITY // University Programming Contests in AtCoder (e.g., UTPC)
241242
FPS_24 // 24 Problems on Formal Power Series
242243
OTHERS // AtCoder (その他)

prisma/tasks.ts

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8116,6 +8116,181 @@ export const tasks = [
81168116
name: '4/N',
81178117
title: 'C. 4/N',
81188118
},
8119+
{
8120+
id: 'awc0005_e',
8121+
contest_id: 'awc0005',
8122+
problem_index: 'E',
8123+
name: 'Mountain Height Survey',
8124+
title: 'E. Mountain Height Survey',
8125+
},
8126+
{
8127+
id: 'awc0005_d',
8128+
contest_id: 'awc0005',
8129+
problem_index: 'D',
8130+
name: 'Splitting Delivery Packages',
8131+
title: 'D. Splitting Delivery Packages',
8132+
},
8133+
{
8134+
id: 'awc0005_c',
8135+
contest_id: 'awc0005',
8136+
problem_index: 'C',
8137+
name: 'Staircase-Shaped Flower Bed',
8138+
title: 'C. Staircase-Shaped Flower Bed',
8139+
},
8140+
{
8141+
id: 'awc0005_b',
8142+
contest_id: 'awc0005',
8143+
problem_index: 'B',
8144+
name: 'Updating the Report Card',
8145+
title: 'B. Updating the Report Card',
8146+
},
8147+
{
8148+
id: 'awc0005_a',
8149+
contest_id: 'awc0005',
8150+
problem_index: 'A',
8151+
name: 'Reward of Multiples',
8152+
title: 'A. Reward of Multiples',
8153+
},
8154+
{
8155+
id: 'awc0004_e',
8156+
contest_id: 'awc0004',
8157+
problem_index: 'E',
8158+
name: 'Sum of Intervals',
8159+
title: 'E. Sum of Intervals',
8160+
},
8161+
{
8162+
id: 'awc0004_d',
8163+
contest_id: 'awc0004',
8164+
problem_index: 'D',
8165+
name: 'Parking Lot Assignment',
8166+
title: 'D. Parking Lot Assignment',
8167+
},
8168+
{
8169+
id: 'awc0004_c',
8170+
contest_id: 'awc0004',
8171+
problem_index: 'C',
8172+
name: 'Minimum Cost of Temperature Adjustment',
8173+
title: 'C. Minimum Cost of Temperature Adjustment',
8174+
},
8175+
{
8176+
id: 'awc0004_b',
8177+
contest_id: 'awc0004',
8178+
problem_index: 'B',
8179+
name: 'Battery Level',
8180+
title: 'B. Battery Level',
8181+
},
8182+
{
8183+
id: 'awc0004_a',
8184+
contest_id: 'awc0004',
8185+
problem_index: 'A',
8186+
name: 'Preparations Before Departure',
8187+
title: 'A. Preparations Before Departure',
8188+
},
8189+
{
8190+
id: 'awc0003_e',
8191+
contest_id: 'awc0003',
8192+
problem_index: 'E',
8193+
name: 'Cargo Delivery Truck',
8194+
title: 'E. Cargo Delivery Truck',
8195+
},
8196+
{
8197+
id: 'awc0003_d',
8198+
contest_id: 'awc0003',
8199+
problem_index: 'D',
8200+
name: 'Consecutive Practice Days',
8201+
title: 'D. Consecutive Practice Days',
8202+
},
8203+
{
8204+
id: 'awc0003_c',
8205+
contest_id: 'awc0003',
8206+
problem_index: 'C',
8207+
name: 'Bargain Sale Selection',
8208+
title: 'C. Bargain Sale Selection',
8209+
},
8210+
{
8211+
id: 'awc0003_b',
8212+
contest_id: 'awc0003',
8213+
problem_index: 'B',
8214+
name: 'Line of Handshakes',
8215+
title: 'B. Line of Handshakes',
8216+
},
8217+
{
8218+
id: 'awc0003_a',
8219+
contest_id: 'awc0003',
8220+
problem_index: 'A',
8221+
name: 'Product Quality Evaluation',
8222+
title: 'A. Product Quality Evaluation',
8223+
},
8224+
{
8225+
id: 'awc0002_e',
8226+
contest_id: 'awc0002',
8227+
problem_index: 'E',
8228+
name: 'Assortment of Sweets',
8229+
title: 'E. Assortment of Sweets',
8230+
},
8231+
{
8232+
id: 'awc0002_d',
8233+
contest_id: 'awc0002',
8234+
problem_index: 'D',
8235+
name: 'Keys and Treasure Boxes',
8236+
title: 'D. Keys and Treasure Boxes',
8237+
},
8238+
{
8239+
id: 'awc0002_c',
8240+
contest_id: 'awc0002',
8241+
problem_index: 'C',
8242+
name: 'Observing Plant Growth',
8243+
title: 'C. Observing Plant Growth',
8244+
},
8245+
{
8246+
id: 'awc0002_b',
8247+
contest_id: 'awc0002',
8248+
problem_index: 'B',
8249+
name: 'Fruit Sorting',
8250+
title: 'B. Fruit Sorting',
8251+
},
8252+
{
8253+
id: 'awc0002_a',
8254+
contest_id: 'awc0002',
8255+
problem_index: 'A',
8256+
name: 'Organizing the Bookshelf',
8257+
title: 'A. Organizing the Bookshelf',
8258+
},
8259+
{
8260+
id: 'awc0001_e',
8261+
contest_id: 'awc0001',
8262+
problem_index: 'E',
8263+
name: 'Temperature Fluctuation Range',
8264+
title: 'E. Temperature Fluctuation Range',
8265+
},
8266+
{
8267+
id: 'awc0001_d',
8268+
contest_id: 'awc0001',
8269+
problem_index: 'D',
8270+
name: 'Merchant on the Highway',
8271+
title: 'D. Merchant on the Highway',
8272+
},
8273+
{
8274+
id: 'awc0001_c',
8275+
contest_id: 'awc0001',
8276+
problem_index: 'C',
8277+
name: 'Discount Coupon',
8278+
title: 'C. Discount Coupon',
8279+
},
8280+
{
8281+
id: 'awc0001_b',
8282+
contest_id: 'awc0001',
8283+
problem_index: 'B',
8284+
name: 'Exam Passers',
8285+
title: 'B. Exam Passers',
8286+
},
8287+
{
8288+
id: 'awc0001_a',
8289+
contest_id: 'awc0001',
8290+
problem_index: 'A',
8291+
name: 'Bacteria Growth Experiment',
8292+
title: 'A. Bacteria Growth Experiment',
8293+
},
81198294
{
81208295
id: 'fps_24_x',
81218296
contest_id: 'fps-24',

src/lib/types/contest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export const ContestType: { [key in ContestTypeOrigin]: key } = {
4444
ABC_LIKE: 'ABC_LIKE', // AtCoder Beginner Contest (ABC) 相当のコンテスト
4545
ARC_LIKE: 'ARC_LIKE', // AtCoder Regular Contest (ARC) 相当のコンテスト
4646
AGC_LIKE: 'AGC_LIKE', // AtCoder Grand Contest (AGC) 相当のコンテスト
47+
AWC: 'AWC', // AtCoder Weekday Contest
4748
UNIVERSITY: 'UNIVERSITY', // University Programming Contests in AtCoder (e.g., UTPC)
4849
FPS_24: 'FPS_24', // 24 Problems on Formal Power Series
4950
OTHERS: 'OTHERS', // AtCoder (その他)

src/lib/utils/contest.ts

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ export const classifyContest = (contest_id: string) => {
1616
return ContestType.AGC;
1717
}
1818

19+
if (/^awc\d{4}$/.exec(contest_id)) {
20+
return ContestType.AWC;
21+
}
22+
1923
if (contest_id.startsWith('APG4b')) {
2024
return ContestType.APG4B;
2125
}
@@ -242,10 +246,10 @@ export function getContestPrefixes(contestPrefixes: Record<string, string>) {
242246
* Contest type priorities (0 = Highest, 21 = Lowest)
243247
*
244248
* Priority assignment rationale:
245-
* - Educational contests (0-10): ABS, ABC, APG4B, etc.
249+
* - Educational contests (0-10, 16): ABS, ABC, APG4B and AWC etc.
246250
* - Contests for genius (11-15): ARC, AGC, and their variants
247-
* - Special contests (16-18): UNIVERSITY, FPS_24, OTHERS
248-
* - External platforms (19-21): AOJ_COURSES, AOJ_PCK, AOJ_JAG
251+
* - Special contests (17-19): UNIVERSITY, FPS_24, OTHERS
252+
* - External platforms (20-22): AOJ_COURSES, AOJ_PCK, AOJ_JAG
249253
*
250254
* @remarks
251255
* HACK: The priorities for ARC, AGC, UNIVERSITY, AOJ_COURSES, and AOJ_PCK are temporary
@@ -271,12 +275,13 @@ export const contestTypePriorities: Map<ContestType, number> = new Map([
271275
[ContestType.ABC_LIKE, 13],
272276
[ContestType.ARC_LIKE, 14],
273277
[ContestType.AGC_LIKE, 15],
274-
[ContestType.UNIVERSITY, 16],
275-
[ContestType.FPS_24, 17],
276-
[ContestType.OTHERS, 18], // AtCoder (その他)
277-
[ContestType.AOJ_COURSES, 19],
278-
[ContestType.AOJ_PCK, 20],
279-
[ContestType.AOJ_JAG, 21],
278+
[ContestType.AWC, 16],
279+
[ContestType.UNIVERSITY, 17],
280+
[ContestType.FPS_24, 18],
281+
[ContestType.OTHERS, 19], // AtCoder (その他)
282+
[ContestType.AOJ_COURSES, 20],
283+
[ContestType.AOJ_PCK, 21],
284+
[ContestType.AOJ_JAG, 22],
280285
]);
281286

282287
export function getContestPriority(contestId: string): number {
@@ -297,20 +302,24 @@ export function getContestPriority(contestId: string): number {
297302
* - "abc"
298303
* - "arc"
299304
* - "agc"
305+
* - "awc"
300306
*
301-
* followed by exactly three digits. The matching is case-insensitive.
307+
* followed by exactly three or four digits. The matching is case-insensitive.
302308
*
303309
* Example matches:
304310
* - "abc376"
305311
* - "ARC128"
306312
* - "agc045"
313+
* - "awc0001"
307314
*
308315
* Example non-matches:
309316
* - "xyz123"
310317
* - "abc12"
311318
* - "abc1234"
319+
* - "awc12345"
312320
*/
313321
const regexForAxc = /^(abc|arc|agc)(\d{3})/i;
322+
const regexForAwc = /^(awc)(\d{4})/i;
314323

315324
/**
316325
* Regular expression to match AtCoder University contest identifiers.
@@ -338,6 +347,13 @@ export const getContestNameLabel = (contestId: string) => {
338347
);
339348
}
340349

350+
if (regexForAwc.exec(contestId)) {
351+
return contestId.replace(
352+
regexForAwc,
353+
(_, contestType, contestNumber) => `${contestType.toUpperCase()} ${contestNumber}`,
354+
);
355+
}
356+
341357
if (contestId === 'APG4b' || contestId === 'APG4bPython') {
342358
return contestId;
343359
}

0 commit comments

Comments
 (0)