编程介的小学生 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条)

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮