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

Турниры > IMPC16 Group Contests > задача:


F5. 50978 - Albanian Coders

IMPC16 Group Contests

Старт: 16.янв.2016 в 10:00:00
Финиш: 16.янв.2016 в 14:00:00
Турнир завершён!
• Турнирная таблица

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

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

• 25. 50877 - Friendly Queue
• 32. 50926 - School Mail Merge
• 33. 50927 - Health Expenses
• 34. 50928 - War Of Battleships
• 35. 50929 - Present from your uncles
• F1. 50841 - My grand-grand-grandfa...
• F2. 50936 - Saving the Soldiers
• F4. 50977 - Gaussian Elimination
• F5. 50978 - Albanian Coders
• F6. 50979 - Minimum access cost for...

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Faruk Bulut.

Albanian Coders

The Albanian students, who have been studying for the Olympiads in Informatics, gather around in the school and study on new topics. They have been practicing by typing codes for the Olympiad competitions.

A prominent member of the community is the hardworking student, Ali abi. Every evening, if Ali is present, he teaches a brand new Olympiad subject that no other student has heard before, and no other topic is thought that night. In the event that Ali is not present, other students learn without him and exchange (teach each other) all knowledge (topics) that they know.

Question: Given the list of students present for D consecutive camp days, output all students that know all topics learned during that period.

Input specification: The first line of input contains an integer N, 1 <= N <= 100, the number of students. The students are numbered 1 to N. Student number 1 is Ali. The second line contains an integer D, 1 <= D <= 50, the number of camp days. The next D lines contain the list of students present on each of the D days. Each line begins with a positive integer K, 2 <= K <= N, the number of students present that day, followed by K positive integers separated by spaces representing the students. No student will appear twice in one day and Ali will appear at least once across all nights.

Output specification:
Output all students that know all topics, including Ali, one integer per line in ascending order.

Sample Input I
4
3
2 1 2
3 2 3 4
3 4 2 1
Sample Input II
8
5
4 1 3 5 4
2 5 6
3 6 7 8
2 6 2
4 2 6 8 1
Sample Input III
5
3
2 1 3
2 2 1
4 2 1 4 5
Sample Output I
1
2
4
Sample Output II
1
2
6
8
Sample Output III
1



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

www.contester.ru