摘要: 并查集好题。看代码吧,相信你会理解的#include <iostream>using namespace std;int root[200001],sum[200001],data,ans;int find(int x){ if(root[x]==-1) return x; int t=root[x]; root[x]=find(root[x]); sum[x]+=sum[t]; return root[x];}void unio(int x,int y){ int rootx=find(x); int rooty=find(y); ... 阅读全文
posted @ 2013-03-19 21:21 SF-_- 阅读(299) 评论(0) 推荐(0) 编辑