Practice · 3 of 3
Component Labels
CHALLENGE
Difficulty: advanced+25 XP
**Bài toán.** Line 1: n m; then m directed edges u v. Print n labels: for every node in order 1..n, the index of its SCC, renumbered 1..k in first-encounter order over nodes 1..n. **Constraints:** 1 ≤ n, m ≤ 200 000. Kosaraju labels in O(n + m). Per-node mutual-reachability scanning is O(n·m) — timeout.
Press Submit to check your solution.
Back to lesson: Practice: SCC Trio