The Trudeau Computer Science Club is famous in Pierre Elliott Trudeau High School for having the best computer scientists in the whole school present in one room. Every week, ZQFMGB12 lectures his dedicated pupils (with PowerPoint) on some cool computer science concept in hopes that they will do well on the CCC.
Unfortunately, it is nearing the time to write power rankings! The power rankings are a ranking of Trudeau computer scientists. Obviously, d and ZQFMGB12 are at the top, so ZQFMGB12 doesn't have to worry about where to place those two.
However, the other students in the Trudeau Computer Science Club have barely written any contests and as a result, it can be hard to rank them properly. Instead, ZQFMGB12 checks their progress on online judges to see how many homework problems they have completed, but that didn't help either since they barely even looked at the homework.
As a last resort, ZQFMGB12 hid secret cameras around their houses to find out how many minutes they spent reviewing his PowerPoints. As controversial as this technique is, ZQFMGB12 is now able to see how dedicated his students are.
He decides that the greater the total time a student spends on his PowerPoints, the better the ranking that student should receive. Specifically, the ranking of a student is 3 plus the number of students with a greater total time. It is guaranteed that no two students have the same total time.
However, ZQFMGB12 has a computer science project due in June and he needs your help in determining the power rankings.
Given the names of ZQFMGB12's students and how long each student spends time on each of his
PowerPoints, can you determine the power rankings?
Input Specification
The first line of input will contain
and
.
The next lines will contain the names of ZQFMGB12's students. Names are unique, will not exceed 50 characters, and will only contain printable non-whitespace ASCII characters.
The next lines will contain
space-separated integers; the
integer on line
specifies the amount of time (in minutes) the
student spent on the
PowerPoint. No student spends a negative number of minutes studying, nor more than
minutes on a single PowerPoint.
Output Specification
On separate lines, from the best rank (lower number) to the worst rank (higher number), output the rank, followed by a period and a single space, and the name of the student with that rank.
Sample Input
5 3
EnochPoon
LiuJason
Nathanl3
AlexW
TT1103
3 4 2 1 0
1 3 4 2 0
5 1 7 4 0
Sample Output
3. Nathanl3
4. EnochPoon
5. LiuJason
6. AlexW
7. TT1103
Comments
Hi right now i'm unable to submit my solutions because it says no judge is available for ranking. Is there a specific way or do I have to wait to submit my solutions. Thanks,
The problem appears to be resolved; try submitting again.
Yes, there seems to be a problem right now. For now, please work on other problems while we try to fix the issue.
Nah... I'm too lazy to do your homework.
But you still spent time on the powerpoints