Practice · 3 of 9
Mixed A3
CHALLENGE
Difficulty: advanced+25 XP
**Bài toán.** There are n isolated vertices. Edges are added one by one. After each edge, print the size of the connected component containing vertex 1. **Constraints:** 2 ≤ n ≤ 200000; edges connect distinct vertices; vertex 1 always exists. **Input:** line 1: n and m; then m lines u v (each edge added in order). **Output:** m lines — the size of 1's component after each addition.
Press Submit to check your solution.
Back to lesson: Practice: Mixed Sets A/B/C — Topics Hidden