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

Турниры > CEN303_2016Questions > задача:


PE12. 50835 - Club Presidency

CEN303_2016Questions

Старт: 28.окт.2016 в 17:00:00
Финиш: 01.ноя.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

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

Задачи турнира

• HW082. 50699 - Fighting Vampires
• HW083. 50671 - Phalanx
• HW091. 51061 - The Longest Path
• HW101. 50682 - Hotel Durres
• HW102. 51067 - Jumping frog
• HW111. 50506 - The Biggest Island
• HW112. 50698 - Ayran Delivery
• PE11. 51023 - Preparing Keyword I...
• PE12. 50835 - Club Presidency
• PE13. 51024 - Total Stock Price
• PE14. 50998 - CEN112 Homework, ...
• PE21. 51071 - Phalanx-2
• PE22. 51072 - Castle on chessboard
• RE1. 51079 - Key person - 2
• RE2. 51080 - Deepest Point

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

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

Лимит времени 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 points
    • if 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:

  1. The number of people voting (n) where n is between 1 and 60,000
  2. The number of candidates (k) where k is between 1 and 60,000
  3. The number of top (m) candidates to show in the end where m is between 1 and 10,000
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).

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.

  1. The first student voted for candidate 5 (which is invalid) and the second candidate (1 points).
  2. The second student gave two points to the third candidate and 1 point to the second candidate
  3. The third student gave two points to the second candidate and 1 point to the fourth candidate
  4. The fourth and fifth students voted for the same person twice, so, the votes are invalid.
Then, the second candidate has 4 points, the third candidate has 2 points, and the fourth candidate has 1 point.



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

www.contester.ru