logo AlgoBeat OnlineJudge
登录 注册

#212518. [INOI Team Selection 2021] Labelless Graph

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Someday Shayan had a graph with vertices, vertices were labeled by numbers 1 to , but it has got stolen from him.

Thieves have sent him pictures of the graph, in each picture exactly one of the vertices is removed, and labels of other vertices are re-indexed from 1 to (each vertex will being removed in exactly one of the graphs).

The thieves have told him if he can tell the size of connected components of the graph, They will give the graph back to him, but sadly Shayan does not remember the answer to this question, so he asked you to help him find the answer.

输入格式

First line contains the number , number of vertices of the graph.

The following lines are the descriptions of the pictures. The -th graph starts with number , the number of edges in the graph without a specific vertex. The vertices are randomly shuffled and are indexed between 1 to . The next lines contain the description of the edges.

It is guaranteed that the input is not self contradictory.

输出格式

In the first line of output print the number of connected components of the graph. In the next line, print the sizes of the components in the non-decreasing order.

样例

样例输入 1

3
1
1 2
1
1 2
1
1 2

样例输出 1

1
3

样例输入 2

5
2
1 2
3 1
1
1 2
2
2 3
1 4
2
2 4
3 4
2
1 2
3 4

样例输出 2

2
2 3

数据范围与提示

Sample Explanation 2

In the second sample, the original graph has two compenents, one of them is a single edge, and the other is a .

Constraints

Subtasks

subtask score limits
1 100 No extra limits