Type: RemoteJudge 1000ms 256MiB

Determine Line

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Determine Line

题面翻译

题目描述

Arkady半梦半醒坐上了一趟电车,在他下了电车后,发现他不知道自己坐的是几号电车。

在他的旅程中,他醒了几次,每次都看到电车停靠在某个站点,并且他知道在这个站点停靠的电车都有哪些。

他想让你帮他确认他可能坐的是几号电车。

输入格式:

第一行一个nn1n1001\le n\le 100),他一共看到停靠了几次。

以下nn行,每行第一个数rr1r1001\le r\le 100),表示在该站点停靠的电车有多少个。

接下来的rr个数,表示在该站点停靠的电车编号。

电车编号在11100100之间。

输出格式

以任意顺序输出他所有可能乘坐的电车编号。

题目描述

Arkady's morning seemed to be straight of his nightmare. He overslept through the whole morning and, still half-asleep, got into the tram that arrived the first. Some time after, leaving the tram, he realized that he was not sure about the line number of the tram he was in.

During his ride, Arkady woke up several times and each time he saw the tram stopping at some stop. For each stop he knows which lines of tram stop there. Given this information, can you help Arkady determine what are the possible lines of the tram he was in?

输入格式

The first line contains a single integer n n ( 2n100 2 \le n \le 100 ) — the number of stops Arkady saw.

The next n n lines describe the stops. Each of them starts with a single integer r r ( 1r100 1 \le r \le 100 ) — the number of tram lines that stop there. r r distinct integers follow, each one between 1 1 and 100 100 , inclusive, — the line numbers. They can be in arbitrary order.

It is guaranteed that Arkady's information is consistent, i.e. there is at least one tram line that Arkady could take.

输出格式

Print all tram lines that Arkady could be in, in arbitrary order.

样例 #1

样例输入 #1

3
3 1 4 6
2 1 4
5 10 5 6 4 1

样例输出 #1

1 4

样例 #2

样例输入 #2

5
1 1
10 10 9 8 7 100 5 4 3 99 1
5 1 2 3 4 5
5 4 1 3 2 5
4 10 1 5 3

样例输出 #2

1

提示

Consider the first example. Arkady woke up three times. The first time he saw a stop with lines 1 1 , 4 4 , 6 6 . The second time he saw a stop with lines 1 1 , 4 4 . The third time he saw a stop with lines 10 10 , 5 5 , 6 6 , 4 4 and 1 1 . He can be in a tram of one of two lines: 1 1 or 4 4 .

20230211排序随堂测验

Not Attended
Status
Done
Rule
Ledo
Problem
7
Start at
2023-2-11 10:30
End at
2023-2-15 14:30
Duration
100 hour(s)
Host
Partic.
32