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

Сборники > Kovrov IT > задача:


50927 - Health Expenses

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

Задачи сборника

• 50748 - Gold Store
• 50658 - The Message
• 50766 - Word Puzzle
• 50934 - Selling Cars
• 50746 - Most Visited
• 50749 - Min Distance
• 50915 - Trip to Korca
• 50985 - Books Waiting
• 50927 - Health Expenses
• 50745 - Bitonic Sequence
• 51083 - Grades Histogram
• 50789 - Number of Cities
• 50983 - Course Selection
• 51024 - Total Stock Price
• 50987 - Very Looong Queue
• 50913 - Manhattan Distance
• 51008 - Sum of Regional Maxes

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

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

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

Health Expenses

There is budget problem and the Ministry of Health and Social Affairs wants to follow health expenses. Ministry records information containing patient IDs, hospital IDs and Doctor IDs. So that they want to see and analyze more, the list of doctors and hospitals who have high costs to the ministry.

Question: Write a program that gets n expense information. Then, list top m doctors who had the biggest costs.

Input specification
You will be given two integers in the beginning: the number of doctor visits (or operations) (n) and the number top doctors to list (m) where 0 ≤ n ≤ 20,000, number of doctors is less than 5,000 (and thus, m is less than 5,000). In the following n lines, you will be given n visit information: 3 numbers (Patient ID, Hospital ID, and the doctor ID) and a floating point number the cost of operation or visit where IDs are integer not greater than 10,000,000.

Output specification:
Show m doctor IDs in descending order according to their expenses (or costs). If there are several doctors with the same cost, list them in ascending order according to doctor IDs.

Sample Input I
7 3
13 6 14 56.4
18 6 14 76.6
8 8 14 86.5
2 2 7 6.7
13 2 14 68.6
8 6 10 32.7
6 8 7 38
Sample Output I
14
7
10

Explanation: The doctor with the ID 14 had 4 operations with a total cost of $288.1. The other two doctos (7 and 10) had total costs $44.7 and $32.7.



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

www.contester.ru