3 人解决,5 人已尝试。
3 份提交通过,共有 11 份提交。
8.4 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
Your task is to divide a number of persons into two teams, in such a way, that:
This task may have many solutions. You are to find and output any solution, or to report that the solution does not exist.
For simplicity, all persons are assigned a unique integer identifier from $1$ to $N$.
The first line in the input file contains a single integer number $N$ ($2 \le N \le 100$) - the total number of persons to divide into teams, followed by $N$ lines - one line per person in ascending order of their identifiers. Each line contains the list of distinct numbers $A_{ij}$ ($1 \le A_{ij} \le N, A_{ij} \neq i$) separated by spaces. The list represents identifiers of persons that $i$th person knows. The list is terminated by $0$.
If the solution to the problem does not exist, then write a single message No solution
(without quotes) to the output file. Otherwise write a solution on two lines. On the first line of the output file write the number of persons in the first team, followed by the identifiers of persons in the first team, placing one space before each identifier. On the second line describe the second team in the same way. You may write teams and identifiers of persons in a team in any order.
5 3 4 5 0 1 3 5 0 2 1 4 5 0 2 3 5 0 1 2 3 4 0
No solution
5 2 3 5 0 1 4 5 3 0 1 2 5 0 1 2 3 0 4 3 2 1 0
3 1 3 5 2 2 4
3 人解决,5 人已尝试。
3 份提交通过,共有 11 份提交。
8.4 EMB 奖励。