G. Swimming
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 43 Accepted Submission(s) : 17
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
In the 2012 London Olympics, Sun Yang, the young Chinese swimmer, wins 2 golden medals and breaks the world record of men's 1500m freestyle. As a Chinese, we are proud of him, and as a ACMer, we can do some simple research on the results show system of the swimming.
When the swimmer touches the edge of the destination, the system will show the fastest 3 swimmers' names and their place. If the swimmer only breaks(strictly less than) the Olympic Record(OR), the numbers shows the place will replaced by the word 'OR'. If breaking the World Record(WR), the numbers shows the place will replaced by the word 'WR'.
Now your task is very simple. Given the swimmers' result, show the winners on the screen.
When the swimmer touches the edge of the destination, the system will show the fastest 3 swimmers' names and their place. If the swimmer only breaks(strictly less than) the Olympic Record(OR), the numbers shows the place will replaced by the word 'OR'. If breaking the World Record(WR), the numbers shows the place will replaced by the word 'WR'.
Now your task is very simple. Given the swimmers' result, show the winners on the screen.
Input
The first line contain an integer T, which indicates the number of the test cases, Each test case consists of 9 lines. The first line is the Olympic Record and the World Record of the game(in the format of MM:SS.ss), and the followed by 8 lines, each line is the name of the swimmer and his/her result. The swimmers' names are all in uppercase letters and contain no space, and the result is in the format of MM:SS.ss. More details in the Sample Input. (Suppose that all the results are different)
Output
For each test case, the output contains 3 lines, the place of the fastest 3 swimmers or 'OR' or 'WR' and their names. There is a blank line between each case.
Sample Input
1 14:38.92 14:34.14 COCHRANE 14:40.34 SUN 14:31.02 MELLOULI 14:40.98 MIKE 15:00.83 BOELDS 15:01.02 SAUHWDNLWH 14:55.55 COBCASM 14:53.22 LISOFN 14:51.00
Sample Output
WR SUN 2 COCHRANE 3 MELLOULI
Author
Source
developing schools contest 5