
c++ 并查集
碳酸钙的01妖精
这个作者很懒,什么都没留下…
展开
-
HDU-1878 欧拉回路(并查集+欧拉回路)
HDU-1878 欧拉回路 欧拉回路是指不令笔离开纸面,可画过图中每条边仅一次,且可以回到起点的一条回路。现给定一个图,问是否存在欧拉回路? Input 测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是节点数N ( 1 < N < 1000 )和边数M;随后的M行对应M条边,每行给出一对正整数,分别是该条边直接连通的两个节点的...原创 2018-02-26 21:04:05 · 241 阅读 · 0 评论 -
POJ-1386 play on words(并查集+欧拉回路)
POJ-1386 play on words(并查集+欧拉回路) Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open ...原创 2018-02-26 22:24:14 · 183 阅读 · 0 评论 -
POJ-2236 Wireless Network(并查集)
POJ-2236 Wireless Network(并查集) An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected ...原创 2018-02-24 13:49:48 · 167 阅读 · 0 评论 -
POJ-2524 Ubiquitous Religions (并查集)
POJ-2524 Ubiquitous Religions (并查集) There are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many diff...原创 2018-02-24 17:14:49 · 199 阅读 · 0 评论 -
POJ-1611 The Suspects(并查集)
POJ-1611 The Suspects Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to...原创 2018-02-24 13:55:23 · 184 阅读 · 0 评论 -
HDU-1213 How Many Tables(并查集)
HDU-1213 How Many Tables Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the ...原创 2018-02-24 13:53:49 · 161 阅读 · 0 评论 -
POJ-1182 食物链(并查集)
POJ-1182 食物链(并查集)动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第...原创 2018-02-24 20:26:04 · 287 阅读 · 0 评论 -
并查集模板
并查集模板void Init(){ for(int i=1;i<=n;i++) father[i]=i;}int Find(int x){ if(x==father[x]) return x; return Find(father[x]);}void Union(int x,int y){ int nx=Find(x); ...原创 2018-06-23 20:51:11 · 135 阅读 · 0 评论