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

Турниры > CEN112 Questions 2016 > задача:


15-PE2-2. 51086 - Top popular student

CEN112 Questions 2016

Старт: 30.мар.2016 в 15:10:22
Финиш: 01.апр.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

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

• 15-PE-2. 50866 - Buy the cheapest
• 15-PE-4. 50868 - Sort Frequencies
• 15-PE-5. 50869 - Birthday Celebration
• 15-PE-7. 50871 - Harmonic Mean
• 15-PE-8. 50872 - Top M Grades
• 15-PE2-1. 50980 - The smallest rect...
• 15-PE2-2. 50981 - Top popular m-st...
• 15-PE2-2. 50984 - Top m hardworki...
• 15-PE2-2. 51086 - Top popular s...
• 15-PE2-3. 50982 - A thief in labyrinth
• 15-PE2-4. 50983 - Course Selection
• 15-PE2-6. 50985 - Books Waiting
• 15-PE2-8. 50987 - Very Looong Queue
• 15-RE-2. 50999 - Overlapping Trips
• 3. 51002 - The most successful classes
• 4. 51003 - Double Prime
• HW092. 51081 - Fish Pond I

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

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

Лимит времени 2199/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Top popular student

Question: For a contest, you are searching for the top-m popular students of the university. You are given friends list of n students where some students may appear several times. Count the unique number of friends for each student and identify the top popular student who has the most number of friends.

Input specification You will be given an integer in the beginning: the number of students (n). In each of the following n lines, you will be given several positive integers (friends of the current student) ending with a negative number where 0 ≤ n ≤ 8,000.

Output specification: Show the ID (order of appearance) of top student who has the most number of friends. If there are several students with the same number friends, first show the student with a smaller ID.

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

Explanation: Here is the list of students with their number of friends.
  1 -> 3
  2 -> 4
  3 -> 4
  4 -> 5
  5 -> 4
  6 -> 3
  7 -> 5



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

www.contester.ru