Checkposts
MediumRating 1700CodeforcesGraph Theory (MST, SCC, Bridges)
Approach hintTry it first, then revealHide
Find strongly connected components. Each component needs exactly one checkpost at its cheapest junction, and the number of ways is the product of how many junctions attain that minimum in each component.