#define _CRT_SECURE_NO_WARNINGS #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define N 100005 int p[N]; struct Edge { int s, e; int cost; }edge[N]; bool cmp(struct Edge a, struct Edge b) { return a.cost <…
ORZ:http://www.cnblogs.com/zrts/p/bzoj3714.html #include<cstdio> #include<algorithm> using namespace std; #define N 2010 int fa[N],rank[N],n,m,tot; long long ans; ]; bool operator < (const Edge &a,const Edge &b){return a.w<b.w;}…