#include #include #include #include using namespace std; const int maxn = 1002; const int maxm = 500002; struct node { int u,v,w,d; bool operator < (const node &other) const { return w > other.w; } }edge[maxm]; int father[maxn]; bool vis[maxn]; int m,n; int find(int u) { return (u == father[u]) ? father[u] : (father[u] = find(father[u])); } void read() { memset(vis,false,sizeof(vis)); for(int i=1;i<=n;i++) father[i] = i; for(int i=0;i