#include #include using namespace std; int fa[55],n,m,cnt; struct node { int u,v,cost; }edge[3000]; int find(int x)//并查集找祖宗 { return fa[x]==x?x:fa[x]=find(fa[x]); } void merge(int a,int b)//集合合并 { int x=find(a); int y=find(b); if(x!=y) fa[y]=x; } void add(int a,int b,int c) { edge[cnt].u=a; edge[cnt].v=b; edge[cnt++].cost=c; } bool cmp(node x,node y)//定义排序优先级 { return x.cost>n&&n) { cnt=0; cin>>m; for(int i=1;i<=n;i++) fa[i]=i; for(int i=0;i>x>>y>>z; add(x,y,z); } cout<