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 r-1 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.