难度: 黄
算法标签: 图论,最短路。
首先我们额外构造一个节点,令其到每个节点距离都为在该节点建立发电站的费用。然后直接跑最小生成树即可。
数据较水,Prim 和 Kruskal 均可过。
By signing up a HFOJ universal account, you can submit code and join discussions in all online judging services provided by us.
Using your HFOJ universal account