编程介的小学生 2017-09-08 04:38 采纳率: 20.5%
浏览 670
已采纳

Final Standings

WishingBone is quite familiar with rules of contest ranking. It states:

Teams are ranked by the number of problems solved in descending order;

Teams that solved the same number of problems are ranked by total penalty time in ascending order;

Teams that have the same rank are listed by team id in lexicographic order, which should be case-insensitive.

Additionally,

A problem is solved only when the team has submitted an accepted run.

Penalty time for a problem is the sum of the elapsed time of the first accepted run and twenty minutes for each previous run of this problem.

Total penalty time is the sum of penalty time for all the problems solved.

Only teams solved at least one problem will be listed on the final standing.

You are requested to generate this final standing.

Input

The first line of input is a positive integer N (N <= 100), which is the number of problems of this contest.

Each line of input represents one run in the form

Elapsed Time Team ID Problem ID Judge Reply

where Elapsed Time is the time from the start of the contest (in minute); Team ID is a string of no more than 30 upper and lower Latin characters; Problem ID is an integer from 1 to N; Judge Reply is one of AC, PE, CE, RE, TLE, MLE and OLE. Elasped Time will be in ascending order. The number of teams will not exceed 10000.

Output

Print one team on each line in the form

Rank Team ID Problems Solved Total Penalty Time

the first three of which should be left-justified in fields of 10, 30 and 10.

Refer to sample output for more details.

Sample Input

3
30 Fatmouse 1 WA
32 Killer 2 AC
39 Turing 3 RE
56 Fatmouse 2 CE
63 Turing 3 AC
77 Killer 1 PE
79 Killer 1 AC
83 ZzZzZ 3 AC
89 Fatmouse 3 OLE
89 Chenyue 3 AC

Sample Output

1 Killer 2 131
2 Turing 1 83
ZzZzZ 1 83
4 Chenyue 1 89

  • 写回答

3条回答

  • threenewbee 2017-09-09 15:51
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料