当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5096:ACM Rank

题目描述
"…… A problem is solved when it is accepted by the judges. Teams are ranked according to the most problems solved. Teams who solve the same number of problems are ranked by least total time. The total time is the sum of the time consumed for each problem solved. The time consumed for a solved problem is the time elapsed from the beginning of the contest to the submittal of the accepted run plus 20 penalty minutes for every rejected run for that problem regardless of submittal time. There is no time consumed for a problem that is not solved."
- ACM/ICPC Contest Rules

You are writing a new ranking system for ACM/ICPC Contests. During a contest, you may receive the following kinds of request from participants:

Submission
(Format: S [minute]:[Team No]:[Problem ID]:[Result])
If a team submits a problem which they have already solved, or the last valid submission of the same team is less than 5 minutes ago, then this submission should be considered invalid and ignored by your system; otherwise, the submission is valid and saved for further processing - if the result is 1 (Correct), then this submission should be considered accepted by the system.

Query a team's rank on the rank list.
(Format: R [Team No])
Sort the teams according to the contest rules mentioned above. A tie may occur between two teams who solved equal number of problems and same penalty.
A rank list example can see below.


Two teams who solved same amount of problems and have same penalty always have same rank.

Query the team with rank K on the rank list.
(Format: T [k])
If a tie occurs, i.e. there are more than one team with rank K, return the team which the first get last accepted submission (according to the input order) (If they are all zero solved problem , just return the team with small number). If there is not a team with rank K, return -1 instead.

Initially every team has no submissions, and the contest will last no more than 5 hours.
输入解释
There are multiple test cases in the input. Each test case starts with two integers, N and M, (1 <= N <= 10000, 1 <= M <= 10), the number of teams participating in the competition, and the total number of problems in the contest. Teams are numbered from 0 to N - 1. Each of the following lines is either in one of the three formats listed above, or a single line "Contest Ends" followed by an empty line indicating the end of current test case. It is guaranteed that there are no more than 100000 requests in each test case. Input ends with End-of-File.
输出解释
For every submission request, if the submitted program is accepted, you need to output a line whose format is [Team No] [Problem ID]; for every query about team's rank on the rank list, output the result in one single line; for every query about the team with the rank K, if a team is found, output a line with one integer, the number of the team, or -1 if you are unable to find such a team. Please print a blank line after each test case. If there are multiple teams with rank K, output the team which the first get last accepted submission (according to the input order) (If they are all zero solved problem , just return the team with small number).
输入样例
5 8
S 5:0:A:0
S 8:0:A:1
S 9:1:B:1
S 15:0:A:1
T 1
T 2
T 3
R 0
R 1
R 2
R 3
Contest Ends
输出样例
[1][B]
[0][A]
1
0
2
2
1
3
3
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5096

最后修改于 2020-10-25T23:19:45+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 65536/65536K(Java/Others)