并查集
文章平均质量分 76
并查集
Marx_W
这个作者很懒,什么都没留下…
展开
-
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 followin...原创 2018-04-21 19:34:50 · 221 阅读 · 0 评论 -
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 frien...原创 2018-04-23 17:03:17 · 181 阅读 · 0 评论 -
并查集讲解
1.首先来看一个实例,杭电1232畅通工程 题目大意:在地图上给你若干个城镇,这些城镇都可以看作点,然后告诉你哪些对城镇之间是有道路直接相连的。最后要解决的是整幅图的连通性问题。比如随意给你两个点,让你判断它们是否连通,或者问你整幅图一共有几个连通分支,也就是被分成了几个互相独立的块。像畅通工程这题,问还需要修几条路,实质就是求有几个连通分支。如果是1个连通分支,说明整幅图上的点都连起来了,不用...转载 2018-04-21 19:21:15 · 213 阅读 · 0 评论