2013年8月29日
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2497题意:给出顶点数,边数及节点s,判断s是否包含在所有的环中;思路:并查集的应用,在除s节点以外的节点中,取出有公共源点的节点放到一个集合中,若还能形成环说明s不能经过所有的环,否则s能经过所有的环; 1 #include 2 #include 3 4 int set[10010],n,m,s; 5 6 int find(int x) 7 { 8 if(set[x] != x) 9 set[x] = find(set[x... 阅读全文
posted @ 2013-08-29 23:23 straw_berry 阅读(185) 评论(0) 推荐(0) 编辑