HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC16 Group Contests > problem:


33. 50927 - Health Expenses

IMPC16 Group Contests

Start: Jan.16.2016 at 10:00:00 AM
Finish: Jan.16.2016 at 02:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (2)

Contest problems

• 14. 50862 - Sum of the Pairs
• 15. 50863 - Total Access Cost of a BST
• 21. 50873 - Max Frequency
• 22. 50874 - Apartment Building Adm...
• 23. 50875 - Take m-out
• 24. 50876 - He is my cousin
• 25. 50877 - Friendly Queue
• 32. 50926 - School Mail Merge
• 33. 50927 - Health Expenses
• 34. 50928 - War Of Battleships
• 35. 50929 - Present from your uncles
• F1. 50841 - My grand-grand-grandfa...
• F2. 50936 - Saving the Soldiers
• F4. 50977 - Gaussian Elimination
• F5. 50978 - Albanian Coders
• F6. 50979 - Minimum access cost for...

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.

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