-->
当前位置:首页 > 题库

PROGRAMMING:Social cluster

Luz5年前 (2021-05-10)题库369
When you register on a social networking platform, you are always required to fill in your personal interests in order to find potential friends with the same interests. A "social cluster" refers to a collection of people with the same interests. You need to find all the social clusters.
###Input format:
Enter a positive integer n ($$\ Le 1000 $$) in the first line to show the number of all users registered for the social networking platform. So these people are numbered from 1 to n. Then n lines, each line gives a list of people's interests in the following format:
$$K_ i$$: $$h_ i[1]$$ $$h_ i[2]$$ ... $$h_ i[K_ i]$$
Where $$k_ I (> 0) $$is the number of interests, $$h_ I [J] $$is the number of the $$J $$interest, which is an integer in the interval [1, 1000].
###Output format:
First, output the number of different social clusters in a row. The second line then outputs the number of people in each cluster in non increasing order. The numbers should be separated by a space, and there should be no extra space at the end of the line.
###Input example:
```in
eight
3: 2 7 10
1: 4
2: 5 3
1: 4
1: 3
1: 4
4: 6 8 1 5
1: 4
```
###Output example:
```out
three
4 3 1
```







answer:If there is no answer, please comment