QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓
統計

在 ICPC 比赛中,滚榜(scoreboard)在最后一小时会被冻结。在冻结期间进行的提交,其结果显示为 Unknown

给你来自以前 ICPC 比赛的多个提交记录。然而,冻结后进行的提交结果被隐藏了。对于每场比赛,确定所有可能成为冠军的队伍。

规则

每次提交由一个四元组表示:

$$(teamname, problemid, time, result)$$

  • teamname:最多 10 个字符的字符串,由大写或小写字母以及数字组成。它标识了进行提交的队伍。
  • problemid:单个大写字母(A–Z),标识所尝试的题目。
  • time:介于 0 和 299 之间(含)的整数,表示自比赛开始以来的分钟数。
  • result:提交的结果:

    • Accepted:提交正确解决了该题目。
    • Rejected:提交未能解决该题目。
    • Unknown:提交结果未知,因为是在滚榜冻结后进行的。
    • 注意:当且仅当提交的时间 $\ge 240$ 时,提交的结果为 Unknown

对于所有结果均已知的比赛,队伍的得分由以下规则决定:

  1. 解题数:该队伍至少有一次 Accepted 提交的题目数量。
  2. 罚时:该队伍解决的所有题目所消耗的总时间(如果没有解决任何题目,则为 0)。

    • 对于每道已解决的题目,按如下方式计算时间: (a) 取该队伍对该题目的第一次 Accepted 提交的时间。 (b) 对于该队伍对同一题目在时间上更早发生且结果为 Rejected 的每一次提交,增加 20 分钟。
    • 如果一次提交的提交时间较小,则认为它比另一次提交更早。
    • 注意:一个队伍在同一分钟内绝不会进行超过一次提交。

冠军队伍是解题数最多,且在解题数相同的队伍中罚时最小的队伍。如果有多支队伍解题数相同且罚时相同,则可能存在多支冠军队伍。

请确定在将每个 Unknown 提交独立地替换为 AcceptedRejected 的所有可能情况中,所有可能成为冠军的队伍。

输入格式

第一行包含一个整数 $T$ ($1 \le T \le 10000$) —— 比赛的数量。

对于每场比赛:

  • 第一行包含一个整数 $s$ ($1 \le s \le 10^5$) —— 该场比赛的提交次数。
  • 接下来的 $s$ 行中,每行按以下格式描述一次提交:

    teamname problemid time result

保证:

  • $T \le 10000$ 且所有比赛的 $\sum s \le 10^5$。
  • teamname 由最多 10 个大写/小写字母和数字组成。
  • problemid 是单个大写字母(A–Z)。
  • time 是介于 0 和 299 之间(含)的整数。
  • resultAcceptedRejectedUnknown
  • 每场比赛至少有一次 Accepted 提交。
  • 一个队伍在同一分钟内绝不会进行超过一次提交。

输出格式

输出 $T$ 行,每场比赛占一行。每行按字典序升序输出所有可能成为该场比赛冠军的队伍名称,队伍名称之间用空格分隔。

样例

输入样例 1

3
4
ASYYPIbf7 D 268 Unknown
3NhYHv8w B 13 Accepted
ASYYPIbf7 B 173 Accepted
dnrkAsPqrA A 107 Accepted
6
T1 A 10 Rejected
T1 A 241 Unknown
T1 B 200 Accepted
T2 A 100 Accepted
T3 C 50 Accepted
T4 D 250 Unknown
4
Alpha A 100 Accepted
Beta B 100 Accepted
Gamma C 240 Unknown
Delta D 299 Unknown

输出样例 1

3NhYHv8w ASYYPIbf7
T1 T3
Alpha Beta

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.