ACM Contest and Blackout
Solution Sketch
Suppose we have a set $S$ which represents all edges that are in MST, and a set $P$ represents all edges that are not in MST.
The crucial observation for getting the next-to-minimal spanning tree is: it can be obtained by adding one edge from $P$ and removing the edge from $S$ which caused the loop after adding an edge from $P$.
AC code
|
|