
并查集
文章平均质量分 54
LEO丶warning
我是菜鸟,大家可以建一个csdn的账号,一起交流。真的挺好用的
展开
-
再水一道并查集,hdu1856
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.Mr Wang selected a room big enough to hold the boys. The boy who are not been c原创 2015-05-08 19:24:43 · 445 阅读 · 0 评论 -
水过一道并查集 hdu1232
并查集的简单题,基本上就是模板,原创 2015-05-08 18:29:39 · 493 阅读 · 0 评论 -
bhu1272小希的迷宫
我A掉的,可以来看看,有详解上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的设计图是否符合她的设计思路。比如下面的例子,前两个是符合条件的,但是最后一个却有两原创 2015-05-07 21:37:02 · 380 阅读 · 0 评论 -
hdu1213How 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 friends know each other, and all the friends do not want to stay with strangers.原创 2015-05-07 16:59:53 · 451 阅读 · 0 评论 -
hdu1875畅通工程再续——基础并查集
简单的并查集,很好做哦相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个小岛之间有路通即可。其中桥的价格为 100元/米。原创 2015-05-27 18:55:07 · 1680 阅读 · 0 评论 -
hdu1325Is It A Tree?——基础并查集(考思路)
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 following properties. There is exactly one node, called the root, to which no direct原创 2015-05-28 20:26:21 · 1423 阅读 · 0 评论 -
hdu3371——最小生成数
坑啊,超时加爆栈,WA了好多次,一次一次的试验下终于解决了,挺爽,再看代码真是挺简单,原创 2015-06-03 20:06:13 · 647 阅读 · 0 评论 -
HDU1198Farm Irrigation——并查集
题意:就是找在整个地图中有多少个连通的水管;思路:先判断是否连通,然后再判断是否需要连接;因为只是判断相邻片段的水管是否连通,所以在存放的时候用0和1来代表总结:这道题有一个小细节,就是如果用并查集存的话,需要注意,一个片段是可以重复使用的,所以如果用编号存根节点的话一定是不对的,所以要用片段在地图上的位置来判断根节点。还有就是一般情况下,数组的开头都用1,把零空出来,会好理解一些原创 2015-06-08 19:41:11 · 507 阅读 · 0 评论 -
HDu1116——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 the doors, the puzzle is very important for us. There is a large number of magnetic plat原创 2015-07-22 10:44:14 · 553 阅读 · 0 评论