|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|5 초||512 MB||5||5||5||100.000%|
There are many great athletes in the world, and it's very hard to say who is the best in the world at a particular sport, especially when different athletes have won different competitions. Here's one possible system for ranking athletes:
You are given the points per finishing place, the weights of the competitions, and the results of the competitions. Can you rank all of the athletes who appeared in the competitions? If multiple athletes have the same score, they will share the same rank and listed in alphabetical order of their names.
The first line of the input gives the number of test cases, T. T test cases follow; each test case consists of the following:
For each test case, output one line containing "Case #x:", where x is the test case number (starting from 1). Then output one line for each athlete, from highest rank to lowest rank, with the format
r: name, where
r is the rank of the athlete and
name is the name of the athlete. You need to rank all of the athletes that appeared in the input.
Z, and is at most 10 characters long.
1 2 1000 500 6 5 BOLT GAY 4 GAY BOLT 1 GAY TIANBING 1 GAY PEIMENG 1 TIANBING LARRY 1 PEIMENG LARRY 2
Case #1: 1: BOLT 2: GAY 3: PEIMENG 3: TIANBING 5: LARRY
In the first case, Bolt scored a total of 7000 in his two competitions. Gay would have scored a total of 8500 if all competitions were counted, but since only the top 2 competitions are counted in this case, Gay scored 6500 and ranked second. Since Peimeng and Tianbing both scored 1500, they both ranked 3rd and listed by their names. Larry is last, since he scored only 1000.