
并查集
AndreaQ
除非宇宙爆炸,地球毁灭,战争爆发,而你时日无多,否则,一切还来得及!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU 1213 How Many Tables
Problem Description 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 fri原创 2015-03-30 19:19:06 · 615 阅读 · 0 评论 -
hdu 3926 Hand in Hand
Problem Description In order to get rid of Conan, Kaitou KID disguises himself as a teacher in the kindergarten. He knows kids love games and works out a new game called "hand in hand". Initiall原创 2015-06-17 11:03:54 · 705 阅读 · 0 评论 -
HDU 1829 A Bug's Life
Problem Description Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bug原创 2015-06-16 17:20:23 · 413 阅读 · 0 评论 -
HDU 1325 Is It A Tree?
Problem Description A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the follow原创 2015-06-09 16:48:42 · 563 阅读 · 0 评论 -
HDU 1232 畅通工程
畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 35747 Accepted Submission(s): 18934 Problem Description 某省调查城镇交通状况,得到现有城镇道路原创 2015-06-09 10:39:01 · 448 阅读 · 0 评论 -
HDU 1856 More is better
Problem Description Mr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of course there are certain requirements.原创 2015-06-11 09:02:34 · 503 阅读 · 0 评论 -
HDU 3172 Virtual Friends
Problem Description These days, you can do all sorts of things online. For example, you can use various websites to make virtual friends. For some people, growing their social network (their friends,原创 2015-06-14 16:47:55 · 483 阅读 · 0 评论 -
并查集之 Find函数
发现自己写了两道题都把Find函数写得一塌糊涂。。。一题是没有路径压缩过不了,一题是因为前面写错过弄混了,不三不四的。。。总结很重要啊!!路径压缩:递归写法:int Find (int x){ if(Father[x] != x) { Father[x] = Find(Father[x]);//原来写成Father[x] = Father[Father[x]]了。。 //不断地找到其根节点并更改其原创 2015-06-14 16:52:19 · 1533 阅读 · 0 评论