ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > CEN_114 Midterm B > задача:


8. 51123 - Mr. Li Criteria

CEN_114 Midterm B

Старт: 14.мая.2020 в 00:00:01
Финиш: 31.мая.2020 в 23:59:59
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (1)

Задачи турнира

• 13. 51124 - Easy Tiae words
• 14. 51136 - Class Average 2
• 15. 50734 - Product Info (In Srt)
• 2. 50453 - The Cubic Difference
• 3. 50346 - The Biggest Date
• 5. 50380 - Sum of the Numbers in t...
• 6. 50443 - Dajte Express
• 7. 50496 - Falling Bricks
• 8. 51123 - Mr. Li Criteria
• 9. 50529 - Row to Table

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Mr. Li Criteria

The names in China is usually quite short. And director Li wants the lists according to the length of names: the shortest name at the top. If there are several names with the same length, then to be sorted in ascending order according to the grades. If the grades are the same too, then show students in the alphabetical order (A comes before B).

Question: Write a program that reads a list of (n) students with their grades. Then, the program prints the top (m) students according to given Director Li criteria.

Input specification: First, you will be given two integers: number of students (n), and number of top students to show (m). The following n lines contain the name and grade of n students where 0 ≤ m ≤ n ≤ 50,000.

Output specification: Show m student names with their grades in m lines.

Sample Input 1 Sample Input 2
7 3
Deng 35
Xun 66
Li 57
Wan 66
Tan 66
Gao 67
Jiang 54
8 4
Fang 75
Cui 58
Qiao 46
Deng 36
Lang 47
Han 96
Long 57
Gu 74
Sample Output 1 Sample Output 2
Li 57
Tan 66
Wan 66
Gu 74
Cui 58
Han 96
Deng 36

Explanation: The list of students sorted according to Mr. Li criteria for the sample input 1:
  Li 57
  Tan 66
  Wan 66
  Xun 66
  Gao 67
  Deng 35
  Jiang 54
Students Tan Wan and Xun have the same name length and same grades, thus, they are put in ascending order according to the names. Gao has the same name length but his grade is above the others and so (s)he comes after Tan, Wan and Xun.



Для отправки решений необходимо выполнить вход.

www.contester.ru