#P10573. [JRKSJ R8] C0mp0nents
[JRKSJ R8] C0mp0nents
Background



Problem Description
Little I has an undirected graph with vertices and edges. It is guaranteed that the graph has no multiple edges and no self-loops. Initially, the vertex weight of vertex is . Little I also has an extra constant .
Little R can perform a very large number of operations. In each operation, she chooses two adjacent vertices such that , and then Little I sets to .
For each , without modifying the weight of the vertex where during the process, Little I wants to know: after some operations, what is the maximum number of vertices in the graph that can satisfy .
Input Format
The first line contains three integers .
The next lines each contain two integers , indicating an edge connecting .
Output Format
Output one line with integers. The -th integer is the answer for .
5 6 1
1 2
1 3
1 5
2 3
2 4
4 5
3 3 5 5 5
8 10 1
1 3
1 4
1 5
2 3
2 7
3 6
4 6
5 8
6 7
7 8
8 8 7 7 5 4 3 3
14 19 2
1 3
1 4
1 9
2 5
2 14
3 7
4 5
4 6
4 7
4 8
5 6
5 11
6 8
7 9
8 10
8 12
9 10
10 11
11 12
2 1 2 4 1 4 2 4 2 5 1 5 1 1
Hint
Constraints
This problem uses bundled testdata.
- Subtask 0 (0 pts): samples.
- Subtask 1 (5 pts): , .
- Subtask 2 (20 pts): , .
- Subtask 3 (25 pts): , .
- Subtask 4 (50 pts): no special limits.
For all testdata: , , . It is guaranteed that the graph has no multiple edges and no self-loops.
Translated by ChatGPT 5