九度1347孤岛连通工程 --并查集kruskal算法
摘要:
1 #include<stdio.h> 2 #include<algorithm> 3 using namespace std; 4 struct edge 5 { 6 int start,end,len; 7 bool operator < (const edge & a)const 8 { 9 return len<a.len;10 }11 };12 int f[1010],m,n;13 void init(){for(int i=1;i<=n;i++)f[i]=i;}14 int root(int a){w... 阅读全文
posted @ 2012-10-18 14:16 dokc 阅读(163) 评论(0) 推荐(0) 编辑