裸的最大生成树,注意判不连通情况 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=20005; int n,m,f[N],con; long long ans; struct qwe { int u,v,w; }a[N]; bool cmp(const qwe &a,const qwe &b) { return a.w>…
因为是棵树 , 所以直接 dfs 就好了... ------------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #define rep( i , n ) for( int i = 0 ; i <…