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.
Для отправки решений необходимо выполнить вход.
|