HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50804 - Marathon

Guest
• Review clarifications (1)

Volume problems

• 50756 - Average of the Nth Student
• 50457 - The Number of Winners
• 50752 - Student Groups
• 50451 - Processing Cost
• 50751 - The biggest Minute
• 50468 - Draw Matrix - 2
• 50470 - Close Pairs - Revised
• 50998 - CEN112 Homework, quiz av...
• 50804 - Marathon
• 50835 - Club Presidency
• 50526 - Gold Market
• 50458 - Weekly Report
• 50872 - Top M Grades
• 50868 - Sort Frequencies
• 50405 - Accounts Receivable
• 50371 - Modified Karnaugh-Map
• 50908 - Buy 1 Get 1

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