并查集
文章平均质量分 74
Rest
这个作者很懒,什么都没留下…
展开
-
Ural 1320. Graph Decomposition(并查集,连通分支边数)
题意:一个图,每次删掉相邻的两条边,问能否把全部的边删完。 解法:若图的每个连通分量都有偶数个边就输出1,否则输出0; #include #include #include using namespace std; int parent[10000],depth[10000]; void Make_Set(int x){ parent[x] = x; depth[x原创 2013-07-26 16:04:05 · 891 阅读 · 0 评论 -
poj1733 & Ural 1003 Parity Game (hash+并查集 )
长度为n的0和1组成的字符串, 然后问第L和R位置之间有奇数个1还是偶数个1. 根据这些回答, 判断第几个是错误(和之前有矛盾)的。 一旦发现有矛盾了,要马上跳出循环, 后面的那些数据不用去管他了,否则如果用continue就WA。 #include #include #include using namespace std; const int MAXX=10005; in原创 2013-07-16 15:25:17 · 949 阅读 · 0 评论