思路 与<15108道路建设>同解,Kruskal硬过就行了。 代码 #include<bits/stdc++.h> using namespace std; const int maxn=100005,maxm=1000005; struct E{ int from,next,to,dis; }edge[maxm*2]; int n,m,u,v,w; int head[maxn],cnt=0,fa[maxn]; int find(int x){ if(fa[x]==x) return x; else return fa[x]=find(f...