CF1056A.Determine Line
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 (2≤n≤100) — the number of stops Arkady saw.
The next n lines describe the stops. Each of them starts with a single integer r (1≤r≤100) — the number of tram lines that stop there. r distinct integers follow, each one between 1 and 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.
第一行包含一个整数 n(2≤n≤100)—— Arkady 所见到的车站数量。
接下来的 n 行描述这些车站。每行以一个整数 r(1≤r≤100)开头,表示停靠该车站的有轨电车线路数量;随后是 r 个互不相同的整数,每个均在 1 到 100 之间(含端点),表示各条线路的编号。这些编号的顺序任意。
保证 Arkady 提供的信息是一致的,即至少存在一条 Arkady 可乘坐的有轨电车线路。
输出格式
Print all tram lines that Arkady could be in, in arbitrary order.
输出 Arkady 可能乘坐的所有有轨电车线路,顺序任意。
输入输出样例
输入#1
3 3 1 4 6 2 1 4 5 10 5 6 4 1
输出#1
1 4
输入#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, 4, 6. The second time he saw a stop with lines 1, 4. The third time he saw a stop with lines 10, 5, 6, 4 and 1. He can be in a tram of one of two lines: 1 or 4.
考虑第一个例子。阿尔卡季共醒来三次。第一次,他看到一个停靠站,有线路 1、4、6;第二次,他看到一个停靠站,有线路 1、4;第三次,他看到一个停靠站,有线路 10、5、6、4 和 1。他可能乘坐的是两条线路之一:1 或 4。
输入解题思路,AI测评打分。不知道怎么写?