HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Sorting and sequences > problem:


50804 - Marathon

Guest
• Review clarifications (1)

Section problems

• 50847 - The first m trains to leave
• 50984 - Top m hardworking employees
• 50740 - Service Time - 1
• 50750 - Service Time - 2
• 50752 - Student Groups
• 50754 - Team Standings
• 50751 - The biggest Minute
• 50998 - CEN112 Homework, quiz av...
• 50804 - Marathon
• 50835 - Club Presidency
• 50747 - Safe boxes against thieves
• 50742 - King Arthur II
• 50352 - Selling Cows
• 50872 - Top M Grades
• 50868 - Sort Frequencies
• Trip to Librazhd
• 50912 - Trip to Librazhd

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Marathon

The organization committee of the marathon Istanbul invited you to write the program to show top m runners.

Question: Write a program that is going to read time information for n-athletes and show the ids of top m athletes.

Input specification
In the first line, you will be given two numbers (n and m). Then, in the following n lines, you will be given 3 integers (hour minute and seconds) where 0 ≤ m ≤ n ≤ 50,000

Output specification
Show m integers: ids of top m runners. If the times are the same, show the athlete with a smaller id.

Sample Input I   
5 3
23 45 58
2 7 3
11 1 20
1 36 3
11 47 4
Sample Input II   
6 4
13 29 27
10 34 33
7 26 10
10 41 45
5 57 56
2 31 28
Sample Output I   
4 2 3
Sample Output II   
6 5 3 2

Explanation (for the first input): The fourth athlete has completed the marathon the fastest in 1 hour 36 minutes and 3 seconds. Then the second athlete comes who has finished in 2 hours 7 minutes and 3 seconds. etc.

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

www.contester.ru