#P7212. [JOISC 2020] ジョイッターで友だちをつくろう
[JOISC 2020] ジョイッターで友だちをつくろう
Description
On Joitter, you can follow other users, but you cannot follow yourself and you cannot follow the same user twice. That is, following the same user multiple times only counts once.
There are new users and days.
On day , user follows user .
Also, after the follow action, a social event is held with the following rules:
- Choose a user .
- Choose a user that is followed by user .
- Choose a user such that , does not follow , and and follow each other.
- Make follow .
- Repeat until no suitable triple can be chosen.
You need to compute, for each , the total number of follows after day .
Input Format
The first line contains two integers .
The next lines each contain two integers .
Output Format
Output lines in total. Each line contains one number. Line represents the total number of follows after day .
4 6
1 2
2 3
3 2
1 3
3 4
4 3
1
2
4
4
5
9
6 10
1 2
2 3
3 4
4 5
5 6
6 5
5 4
4 3
3 2
2 1
1
2
3
4
5
7
11
17
25
30
Hint
Subtasks
For of the testdata, it is guaranteed that , , , , and .
| Subtask ID | Score | |
|---|---|---|
| None |
Notes
This problem is translated from Day 2 T2 “ジョイッターで友だちをつくろう” of The 19th Japanese Olympiad in Informatics Spring Training Camp, T2 ジョイッターで友だちをつくろう.
Translated by ChatGPT 5
京公网安备 11011102002149号