Shichikuji and Power Grid
HardRating 1900CodeforcesMixed Practice
Approach hintTry it first, then revealHide
Add a virtual vertex joined to every city by an edge whose cost is building a power station in that city. A minimum spanning tree of this dense graph, built with O(n^2) Prim, gives the optimal plan.