会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
windmissing
博客园
首页
新随笔
管理
HDU2818 Building Block 并查集
//很祼的并查集 #include "UnionFindSet.h" #include <iostream> using namespace std; int main() { UFS ufs; int P, X, Y; char ch; cin>>P; while(P--) { cin>>ch; if(ch == 'M') { cin>>X>>Y; ufs.Union(X,Y,-1); } else { cin>>X; ufs.Find(X); cout<<ufs.depth[X]<<endl; } } return 0; }
posted @
2011-12-30 15:53
windmissing
阅读(
87
) 评论(
0
)
编辑
收藏
举报
刷新页面
返回顶部