2016: Sort the Students
| Result | TIME Limit | MEMORY Limit | Run Times | AC Times | JUDGE |
|---|---|---|---|---|---|
| 3s | 8192K | 1408 | 531 | Standard |
Given the class numbers and the scores of a group of students, you are to write a program to sort the students first by class number in ascending order and then by score in descending order.
Input
The input contains only one test case. The first line of the input contains an integer N(N<=300), indicating the number of students you are to sort. From the second line of the input, there are N lines, each of which contains two integers Ai and Bi, indicating the class number and the score of the ith student.
Output
The output should contain N lines exactly, which should be sorted first by class number in ascending order and then by score in descending order. Each line of the output should contain two integers Aj and Bj(separated by a space) of the student in position j after sorting.
There shoud be no other information or blank in the output. See the sample output below for more details.
Sample Input
5 2 90 2 89 1 65 3 95 2 95
Sample Output
1 65 2 95 2 90 2 89 3 95
Problem Source: 2nd JLU Programming Contest
This problem is used for contest: 6
Submit / Problem List / Status / Discuss
1368

被折叠的 条评论
为什么被折叠?



