![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
文章平均质量分 83
键盘上的舞者
这个作者很懒,什么都没留下…
展开
-
POJ1611:The Suspects
DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best str原创 2013-03-20 23:03:22 · 1373 阅读 · 0 评论 -
LA3644:X-Plosives(并查集)
A secret service developed a new kind of explosive that attain its volatile property only when a speci cassociation of products occurs. Each product is a mix of two different simple compounds, to whi原创 2015-06-10 21:16:56 · 739 阅读 · 0 评论 -
LA3027:Corporative Network(并查集)
A very big corporation is developing its corporative network. In the beginning each of the N enterprises of thecorporation, numerated from 1 to N, organized its own computing and telecommunication c原创 2015-06-10 22:03:40 · 1419 阅读 · 0 评论 -
CSU1633: Landline Telephone Network
DescriptionThe mayor of RMRCity wants to create a secure landline telephone network for emergency use in case of serious disasters when the city is cut off from the outside world. Some pairs of bu原创 2015-05-25 14:41:07 · 1069 阅读 · 0 评论 -
UVA11987:Almost Union-Find
题意:初始时,一共有n个元素的组合1,2,3....n给出三个操作1 p q:合并p,q所在的集合2 p q:把p移动到q所在的集合3 p:输出p所在的集合的元素的个数思路:比较巧妙的并查集,我们通过编号来标记节点,当一个元素移除的时候,我们可以通过对其目前父节点的sum与cnt进行更新,只要减掉就可以看做已经移除了而目前这个数值对应的值可以改成一个还没有使原创 2015-06-17 17:04:26 · 1352 阅读 · 0 评论 -
CSU1601: War(并查集)
DescriptionAME decided to destroy CH’s country. In CH’ country, There are N villages, which are numbered from 1 to N. We say two village A and B are connected, if and only if there is a road betwe原创 2015-05-03 19:55:02 · 1053 阅读 · 0 评论 -
POJ1962:Corporative Network(并查集)
DescriptionA very big corporation is developing its corporative network. In the beginning each of the N enterprises of the corporation, numerated from 1 to N, organized its own computing and telec原创 2015-04-24 21:26:36 · 1522 阅读 · 0 评论 -
URAL1962:In Chinese Restaurant(并查集)
When Vova arrived in Guangzhou, his Chinese friends immediately invited him to a restaurant. Overalln people came to the restaurant, including Vova. The waiter offered to seat the whole company at a原创 2015-04-19 22:21:38 · 1273 阅读 · 0 评论 -
CSU1326: The contest(并查集+分组背包)
Description 殷犇有很多队员。他们都认为自己是最强的,于是,一场比赛开始了~ 于是安叔主办了一场比赛,比赛有n个题目,每个题目都有一个价值Pi和相对能力消耗Wi,但是有些题目因为太坑不能同时做出来,并且坑题具有传递性。(a和b一起做会坑、b和c会坑则a和c也会坑) ACM队员们想知道,于是他们想知道在能力范围内,它们最多可以作出多少价值的题目。 聪明的你原创 2013-10-03 21:34:12 · 1696 阅读 · 0 评论 -
BNU16485:Build The Electric System(并查集)
In last winter, there was a big snow storm in South China. The electric system was damaged seriously. Lots of power lines were broken and lots of villages lost contact with the main power grid. The go原创 2013-10-03 14:59:53 · 2626 阅读 · 0 评论 -
HDU2545:树上战争
Problem Description给一棵树,如果树上的某个节点被某个人占据,则它的所有儿子都被占据,lxh和pfz初始时分别站在两个节点上,谁当前所在的点被另一个人占据,他就输了比赛,问谁能获胜 Input输入包含多组数据每组第一行包含两个数N,M(N,M接下来N-1行,每行2个整数A,B(1接下来M行,每行有2个数,表示lxh和pfz的初始位置的编号X,Y原创 2013-03-21 17:52:57 · 1620 阅读 · 0 评论 -
HDU1232:畅通工程
Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( 注意:原创 2013-03-21 16:22:13 · 1411 阅读 · 0 评论 -
HDU1325: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 follo原创 2013-03-27 20:34:50 · 1530 阅读 · 0 评论 -
HDU2818:Building Block
Problem DescriptionJohn are playing with blocks. There are N blocks (1 M X Y : Put the whole pile containing block X up to the pile containing Y. If X and Y are in the same pile, just ignore thi原创 2013-03-26 20:53:45 · 1781 阅读 · 0 评论 -
HDU1272:小希的迷宫
Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。原创 2013-03-26 16:56:46 · 1476 阅读 · 0 评论 -
HDU1856:More is better
Problem DescriptionMr 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-03-26 14:53:31 · 1462 阅读 · 0 评论 -
POJ2524:Ubiquitous Religions
DescriptionThere 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 different religions students in your un原创 2013-03-20 21:13:49 · 1102 阅读 · 0 评论 -
HDU1213:How Many Tables
Problem DescriptionToday 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原创 2013-03-24 23:07:37 · 1526 阅读 · 0 评论 -
HDU3234&&UVA12232&&LA4487:Exclusive-OR(经典带权并查集)
Problem DescriptionYou are not given n non-negative integers X0, X1, ..., Xn-1 less than 220 , but they do exist, and their values never change.I'll gradually provide you some facts about them原创 2015-06-15 23:08:32 · 2404 阅读 · 0 评论