QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#9320. 寻找最简单的题目

Statistics

你将获得一场 ICPC 风格比赛的所有提交记录。对于每一条提交,你都知道队伍名称、题目 ID 以及该提交是被接受(accepted)还是被拒绝(rejected)。你的任务是确定哪道题是最简单的。

如果你不熟悉 ICPC 规则,这里有一个简要说明:

  • 每支队伍可以对一道题进行多次提交。如果一支队伍对某道题的提交中至少有一次被接受,则认为该队伍解决了这道题。
  • 解决某道题的队伍数量是指至少有一次该题被接受提交的不同队伍的数量。

我们将比赛中最简单的题目定义为被最多队伍解决的题目。如果有多个题目被相同数量的队伍解决,则题目 ID 字典序最小的题目被认为是最简单的。

当且仅当队伍名称不同时,两支队伍被视为不同。同样,当且仅当题目 ID 不同时,两个题目被视为不同。

输入格式

第一行包含一个整数 $t$ ($1 \le t \le 1000$),表示测试用例的数量。

对于每个测试用例:

第一行包含一个整数 $n$ ($1 \le n \le 10^5$),表示提交的数量。

接下来的 $n$ 行,每行包含一个队伍名称、一个题目 ID 和提交结果。

  • 队伍名称是一个非空字符串,最多包含 10 个字符,可以包含大小写英文字母。
  • 题目 ID 是一个大写英文字母('A' 到 'Z')。
  • 提交结果为 accepted 或 rejected。

保证每个测试用例中至少有一个 accepted 提交。

同时保证所有测试用例的提交总数不超过 $10^5$。

输出格式

对于每个测试用例,输出一行,包含最简单题目的题目 ID。

样例

输入 1

2
5
teamA A accepted
teamB B rejected
teamC A accepted
teamB B accepted
teamD C accepted
4
teamA A rejected
teamB A accepted
teamC B accepted
teamC B accepted

输出 1

A
A

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.