| 
 
 
 | Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. 15PrE2-04.
 
 
   Club Presidency  
Club presidency election is going on at the 
university. As the club members, you have 
decided for the following rules:
 
Everybody can vote for two candidates.If one of the votes for a non existing candidate, 
only that part of the vote is invalid.If somebody votes twice for the same person, 
all the vote is invalid.
If a candidate is in the first position, 
(s)he takes 2 pointsif a candidate is in the second 
position, (s)he gets 1 point. Question:
Write a program that is going to calculate the 
votes received and show the 
IDs of top m candidates.  Input specification  In the first line, you will be given three integers:
 
where candidates have the IDs from 1 to k. 
Then, in the following n lines, you will be given 2 
integers (IDs of the candidates voted).The number of people voting (n) where n is between 1 and 60,000The number of candidates (k) where k is between 1 and 60,000The number of top (m) candidates to show in 
the end where m is between 1 and 10,000 Output specification  Show IDs of top m candidates. If there are 
two candidates with the same points, first show
the one whose ID is smaller.
  
| Sample Input 
 
5 4 2 5 2
 3 2
 2 4
 2 2
 3 3
 
 | Sample Output 
 
2 3
 |   Explanation:
There are 4 candidates and 5 students voted.
 
Then, the second candidate has 4 points, 
the third candidate has 2 points, and 
the fourth candidate has 1 point.The first student voted for candidate 5 
(which is invalid) and the second candidate (1 points).The second student gave two points to the third candidate 
and 1 point to the second candidate  The third student gave two points to 
the second candidate and 1 point to the fourth candidate The fourth and fifth students voted for 
the same person twice, so, the votes are invalid. 
 Для отправки решений необходимо выполнить вход.
 
 
 |