2012年7月21日

【解题报告】【HDOJ1272】【并查集】小希的迷宫

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1272判断条件1.无环2.连通(其实就是构造树的条件)注意:要考虑树时空的情况,0 0也是树,空树。 1 #include<stdio.h> 2 #include<string.h> 3 int root[100001]; 4 int used[100001]; 5 int find(int x) 6 { 7 int t; 8 if(root[x]==x) 9 return x;10 t=find(root[x]);11 root[x]=t;12 ... 阅读全文

posted @ 2012-07-21 16:49 coding封神 阅读(130) 评论(0) 推荐(0) 编辑

导航