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

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


RE1. 51079 - Key person - 2

CEN303_2016Questions

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

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

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

• 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 Кб.
Question by Ibrahim Mesecan.

Key person - 2

You have a company and you can get/buy friendship information from several internet companies. Now, you want to hire m people who has the greatest number of connections. If there are people with the same number of friends/connections, put them in ascending order according to their total relationship costs and ids.

Question: Write a program that will read e relationship information for n people. Then, it will find m people for your company.
Notes:

  1. The weight/length of relationship from one person to another is 1 if one knows the other (if person A knows person B and Person B knows Person C, then person A knows person C with the length of 2),
  2. Assume that length of self-relation is zero,
  3. If person A knows another (B), it does not mean that person B knows person A (the relationships are directed).
  4. Assume that if one person does not know another the distance between them is max (9999),

Input specification: You will be first given three integers:
  1. the number of people (n) and
  2. the number of relationships (e)
  3. the number of people to show (m)
Then in the following e lines, you will be given two integers:
  • ID of the person a: an integer between 1 and n
  • ID of the person b: an integer between 1 and n
which means a knows b; where 1 ≤ m ≤ n ≤ 200 and 0 ≤ e ≤ 10,000.

Output specification: Show m integers: the IDs (orders) of m people.

Sample Input Sample Output
7 12 3
1 2
1 4
2 4
3 1
3 6
4 3
4 5
4 7
5 2
5 7
4 6
7 6
4 1 2

Explanation: Person 1 knows Persons 2 and 4 directly. But he knows Persons 3, 5, 6, and 7 with a length of 2. So, Person 1 knows 6 people with a total distance of (0+1+2+1+2+2+2=)10. The table below shows the number of people they know and the total distance for those people.

Person ID People knows Total Distance
4 68
1 610
2 612
3 612
5 613
7 11
6 00


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

www.contester.ru