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

PROGRAMMING:Fold the cat

Luz5年前 (2021-05-10)题库449
The annual cat folding activity is coming again. This time, the two groups can be merged after the cat folding invites others to join the group.
Now there are $$n $$individuals participating in this activity, $$M $$times of invitation, and each time output the number of members after merging.
###Input format:
Input to give 2 positive integers in one line $$n, m (1 < = n, m < = 10 ^ 5) $$.
In the next $$M $$line, enter two positive integers $$X, y (1 < = x, y < = n) $$in each line to represent $$x $$and invite $$y $$into the group
###Output format:
After each invitation, output an integer in a row to represent the total number of people in the group where $$y $$.
###Input example:
Here is a set of inputs. For example:
```in
5 4
1 2
3 4
2 3
2 4
```
###Output example:
The corresponding output is given here. For example:
```out
two
two
four
four
```
###Tips:
20% data, $$1 < = n, m < = 10$$
40% data, $$1 < = n, m < = 10 ^ 2$$
60% data, $$1 < = n, m < = 10 ^ 4$$
For 100% of data, $$1 < = n, m < = 10 ^ 5 $$< br > < br > < br > < br > < br > is used


answer:If there is no answer, please comment