Backup Network
Challenge on lesson: Contest 2-A: Backup Network
CHALLENGE
Difficulty: advanced+25 XP
**Problem.** Line 1: n m. Then m lines: u v w (undirected cable, distinct weights). Print the weight of the SECOND-best spanning tree — the minimum total weight over all spanning trees different from the MST. **Constraints:** 2 <= n <= 2000; n-1 <= m <= 4000; weights distinct, <= 1e6. A spanning tree always exists. **R versus W.** The graded wrong solution sorts edges descending and reports the maximum spanning tree's weight. Target: full solve within 40 minutes.
Press Submit to check your solution.
Back to lesson: Contest 2-A: Backup Network