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

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试