Skip to main content

Practice · 5 of 6

Contest 2 — Problem B: The Relay

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** A directed graph with n vertices and m edges is guaranteed acyclic. Find the maximum number of edges on any directed path. **Constraints:** 1 ≤ n ≤ 200000; 0 ≤ m ≤ 300000. **Input:** line 1: n, m; then m lines: u → v. **Output:** one integer — the longest path's edge count (0 if no edges).

Back to lesson: Practice: Mock Contests 1 & 2