Skip to main content

Practice · 3 of 5

Provinces Under Construction

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** n cities; m roads open one at a time. After each road opens, print the number of connected groups. **Constraints:** 1 ≤ n ≤ 200000; 1 ≤ m ≤ 300000. **Output:** m lines. Re-scanning the whole graph after every road is far too slow at full scale.

Back to lesson: Practice: Combination Drill — Five Fusions