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

PROGRAMMING:Wechat Moments

Luz5年前 (2021-05-10)题库503
There are n students in a school, forming m clubs. The students in each club have some similar interests, forming a circle of friends. A student can belong to several different clubs at the same time. According to the inference "my friend's friend is also my friend", if a and B are friends, and B and C are friends, then a and C are friends. Please write a program to calculate how many people are in the biggest circle of friends.
###Input format:
The first line of input contains two positive integers n ($$$30000) and m ($$$1000), representing the total number of students in the school and the number of clubs, respectively. In the following M lines, each line gives the information of a club in the following format, in which students are numbered from 1 to N:
`Number of i-th Club mi (space) student 1 (space) student 2... Student mi`
###Output format:
The output gives an integer indicating how many people are in the largest circle of friends.
###Input example:
```in
7 4
3 1 2 3
2 1 4
3 5 6 7
1 6
```
###Output example:
```out
four
```






answer:If there is no answer, please comment