The Monk and Class Marks
Practice
4 (173 votes)
Ad Hoc
Sorting algorithm
Open
Approved
Easy
Problem
76% Success 29606 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Monk is a multi-talented person, and prepares results for his college in his free time. (Yes, he is still in love with his old college!) He gets a list of students with their marks. The maximum marks which can be obtained in the exam is 100.

The Monk is supposed to arrange the list in such a manner that the list is sorted in decreasing order of marks. And if two students have the same marks, they should be arranged in lexicographical manner.

Help Monk prepare the same!

Input format:
On the first line of the standard input, there is an integer N, denoting the number of students. N lines follow, which contain a string and an integer, denoting the name of the student and his marks.

Output format:
You must print the required list.

Constraints:
1 <= N <= 105
1 <= | Length of the name | <= 100
1 <= Marks <= 100

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
245 votes
Tags:
Easy
Points:20
1 votes
Tags:
AlgorithmsEasySorting
Points:20
2 votes
Tags:
ImplementationSortingEasyEasy