| 277 | |
| 278 | class Contest: |
| 279 | def __init__(self, contest_seq: int, contest_type: int = 1): |
| 280 | double = contest_type % 2 == 0 |
| 281 | url_pattern = BIWEEKLY_URL if double else WEEKLY_URL |
| 282 | slug_pattern = BIWEEKLY_SLUG if double else WEEKLY_SLUG |
| 283 | self.contest_type = contest_type |
| 284 | self.contest_url = url_pattern.format(contest_seq) |
| 285 | self.contest_title_slug = slug_pattern.format(contest_seq) |
| 286 | self.contest_title = ( |
| 287 | f"第 {contest_seq} 场双周赛" if double else f"第 {contest_seq} 场周赛" |
| 288 | ) |
| 289 | self.contest_title_en = ( |
| 290 | f"Biweekly Contest {contest_seq}" |
| 291 | if double |
| 292 | else f"Weekly Contest {contest_seq}" |
| 293 | ) |
| 294 | |
| 295 | @staticmethod |
| 296 | def format_time(timestamp: int) -> str: |