摘要: 并查集 1 #include<iostream> 2 using namespace std; 3 4 const int MAX=1000; 5 int father[MAX]; 6 7 void initial(int n) //初始化 8 { 9 for(int i=1;i<=n;i++)10 father[i]=i;11 }12 13 int find(int x) //查找14 {15 while(father[x]!=x)16 x=father[x];17 18 return x;19 }20 21 void ... 阅读全文
posted @ 2013-03-02 16:00 再见~雨泉 阅读(169) 评论(0) 推荐(1)