![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
文章平均质量分 79
清溪浅水
这个作者很懒,什么都没留下…
展开
-
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.原创 2013-08-16 09:35:36 · 577 阅读 · 0 评论 -
hdu——1232——畅通工程
Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input 测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N (原创 2013-08-16 10:07:25 · 537 阅读 · 0 评论 -
并查集
1、 概述 并查集(Disjoint set或者Union-find set)是一种树型的数据结构,常用于处理一些不相交集合(Disjoint Sets)的合并及查询问题。 2、 基本操作 并查集是一种非常简单的数据结构,它主要涉及两个基本操作,分别为: A. 合并两个不相交集合 B. 判断两个元素是否属于同一个集合 (1) 合并两个不相交集合(Union(x,y))原创 2014-02-15 22:38:29 · 476 阅读 · 0 评论 -
uva——11987——Almost Union-Find
I hope you know the beautiful Union-Find structure. In this problem, you're to implement something similar, but not identical. The data structure you need to write is also a collection of disjoint se原创 2014-02-17 21:22:47 · 573 阅读 · 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原创 2014-02-18 12:40:30 · 512 阅读 · 0 评论