 Ranking List 列表问题

Description
Background
We knew something would be missing. We have just noticed that we do not have a tool helping us with the ranking list for this programming contest, and if we tried to create it by hand, you would probably end up waiting for the results until Sunday. So please help us out here, will you?
Problem
Your task is to write a program that determines the ranking list for a programming contest. You are given a list of the participating teams and a log file describing all the solutions submitted by the teams.
The scoring of this programming contest is based on the following set of rules:
The Contest Judges are solely responsible for determining the correctness of submitted runs. The winners of the Contest are determined by the Contest Judges and the Contest Director. The Contest Judges are empowered to adjust for or adjudicate unforeseen events and conditions.
Teams will be ranked by the total number of correct solutions. For the purpose of awards, or in determining qualifier(s) for the ACM Contest, teams who solve the same number of problems are ranked by least total time. If this results in a draw situation the least number of attempts for each solved problems are taken into account. First the number of submissions for the problem with the most attempts are compared.
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.We are sure that you know all this. However, we think that the provisions of the second rule for resolving a draw situation are somewhat obscure, so that we do not want your program to implement such a procedure.Instead, if there is a draw situation of two or more teams with the same total number of correct solutions and the same total time, assign the same rank to these teams and list them in alphabetical order. Their relative ranking will be determined by the contest director, based on the number of attempts for each solved problems or the earliest problem solved.
As we want the rank r of a team to indicate that r1 teams did better, we need to adjust the numbers in a draw situation. If, for example, the two best teams' numbers of solved problems and total times coincide,they would both get rank 1, while the next team would be assigned rank 3. In this example, nobody would be assigned rank 2 by your program.
We also have an addition to the third rule: There will be no penalty for incorrect solutions submitted after a correct solution was accepted from the same team.
InputThe first line contains the number of scenarios.
For each scenario, you find the number n, 1 <= n <= 20, of teams in the first line and the (unique) names of the teams in the n following lines. A team name is a single word of length at most 8 containing letters and digits only, and for your convenience the teams are listed in alphabetical order. The next line contains the number k of problems and the number m of solutions that were submitted (1 <= k < 10, 0 <= m <= 2000). Each of the following m lines describes one such solution, in the format "problem time correctness team", where 1 <= problem <= k is the number of the problem,0 <= time < 300 is the number of minutes elapsed since the contest was started, correctness is either "Yes" or "No" and team is the name of the team that submitted the solution. You can assume that the lines in the log file are sorted by time.
OutputFor each scenario print a ranking list containing every team that participated in the contest. The format is "rank. team solved time", where rank is the rank, team the name of the team, solved the number of correct solutions, and time the total time. In addition to the single blanks separating these four fields, make the table look nice by using a field width of 2 for the rank, 8 for the team's name, 1 for the number of problems solved and 4 for the total time (name leftadjusted, numbers rightadjusted, see sample output). Each scenario ends with a blank line.
Sample Input2
10
Team1
Team2
Team3
Team4
Team5
Team6
Team7
Team8
Team9
slowTeam
8 14
1 18 Yes Team4
1 57 Yes Team2
1 87 Yes Team3
1 101 Yes Team1
2 103 Yes Team5
2 120 Yes Team6
6 141 Yes Team7
1 147 No Team1
7 156 Yes Team2
5 167 Yes Team8
2 167 Yes Team9
5 170 No Team4
5 175 Yes Team4
1 234 No slowTeam
1
Team1
8 0
Sample Output Team2 2 213
 Team4 2 213
 Team3 1 87
 Team1 1 101
 Team5 1 103
 Team6 1 120
 Team7 1 141
 Team8 1 167

Team9 1 167
 slowTeam 0 0
Team1 0 0
 博客 在中国程序员是青春饭吗？
 博客 程序员请照顾好自己，周末病魔差点一套带走我。
 博客 技术大佬：我去，你写的 switch 语句也太老土了吧
 博客 和黑客斗争的 6 天！
 博客 上班一个月，后悔当初着急入职的选择了
 博客 女程序员，为什么比男程序员少？？？
 博客 总结了 150 余个神奇网站，你不来瞅瞅吗？
 博客 副业收入是我做程序媛的3倍，工作外的B面人生是怎样的？
 博客 如果你是老板，你会不会踢了这样的员工？
 博客 我入职阿里后，才知道原来简历这么写
 博客 外包程序员的幸福生活
 博客 优雅的替换ifelse语句
 博客 深入剖析Springboot启动原理的底层源码，再也不怕面试官问了！
 博客 离职半年了，老东家又发 offer，回不回？
 博客 2020阿里全球数学大赛：3万名高手、4道题、2天2夜未交卷
 博客 男生更看重女生的身材脸蛋，还是思想？
 博客 为什么程序员做外包会被瞧不起？
 博客 当HR压你价，说你只值7K，你该怎么回答？
 博客 面试：第十六章：Java中级开发（16k）
 博客 面试阿里p7，被按在地上摩擦，鬼知道我经历了什么？
 博客 你期望月薪4万，出门右拐，不送，这几个点，你也就是个初级的水平
 博客 面试了一个 31 岁程序员，让我有所触动，30岁以上的程序员该何去何从？
 博客 大三实习生，字节跳动面经分享，已拿Offer
 博客 程序员垃圾简历长什么样？
 博客 《经典算法案例》0108：如何使用质数设计扫雷（Minesweeper）游戏
 博客 《Oracle Java SE编程自学与面试指南》最佳学习路线图（2020最新版）
 博客 字节跳动面试官竟然问了我JDBC？
 博客 面试官：你连SSO都不懂，就别来面试了
 博客 终于，月薪过5万了！
 博客 自从喜欢上了B站这12个UP主，我越来越觉得自己是个废柴了！