![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM_并查集、最小生成树
名字太长容易被发现并打死
这个作者很懒,什么都没留下…
展开
-
PTA 部落 (25分) 并查集
在一个社区里,每个人都有自己的小圈子,还可能同时属于很多不同的朋友圈。我们认为朋友的朋友都算在一个部落里,于是要请你统计一下,在一个给定社区中,到底有多少个互不相交的部落?并且检查任意两个人是否属于同一个部落。输入格式:输入在第一行给出一个正整数N(≤104),是已知小圈子的个数。随后N行,每行按下列格式给出一个小圈子里的人:K P[1] P[2] ⋯ P[K]其中K是小圈子里的人数,P[i](i=1,⋯,K)是小圈子里每个人的编号。这里所有人的编号从1开始连续编号,最大编号不会超过104。之原创 2020-11-24 17:03:45 · 371 阅读 · 0 评论 -
POJ -1308 HDU -1325 Is It A Tree?
Is It A Tree?Time Limit: 1000MSMemory Limit: 10000KDescriptionA 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 ...原创 2019-08-12 15:50:01 · 390 阅读 · 0 评论 -
HDU -1213 How Many Tables(并查集)
How Many TablesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionToday is Ignatius’ birthday. He invites a lot of friends. Now it’s dinner ti...原创 2019-08-13 17:15:26 · 395 阅读 · 0 评论 -
POJ- 1611 The Suspects(并查集)
The SuspectsTime Limit: 1000MSMemory Limit: 20000KDescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-M...原创 2019-08-13 17:09:04 · 349 阅读 · 0 评论 -
POJ -2524 Ubiquitous Religions(并查集)
Ubiquitous ReligionsTime Limit: 5000MSMemory Limit: 65536KDescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interes...原创 2019-08-13 16:54:36 · 365 阅读 · 0 评论 -
HDU -1272 小希的迷宫(并查集)
小希的迷宫Time Limit: 2000/1000 MS (Java/Others)Time Limit: 2000/1000 MS (Java/Others)Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是...原创 2019-08-13 16:23:59 · 322 阅读 · 0 评论 -
HDU -1233 还是畅通工程(并查集,最小生成树)
还是畅通工程Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Problem Description某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公...原创 2019-08-13 16:17:30 · 417 阅读 · 0 评论 -
HDU -1232 畅通工程(并查集)
畅通工程Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互...原创 2019-08-13 16:11:00 · 358 阅读 · 0 评论 -
POJ -2236 Wireless Network(并查集)
Wireless NetworkTime Limit: 10000MSMemory Limit: 65536KDescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the...原创 2019-08-13 16:03:21 · 420 阅读 · 0 评论 -
POJ -1287 Networking(并查集,最小生成树)
NetworkingTime Limit: 1000MSMemory Limit: 10000KDescriptionYou are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, a...原创 2019-08-13 10:39:29 · 405 阅读 · 0 评论 -
POJ -2377 Bad Cowtractors(并查集,最小生成树)
Bad CowtractorsTime Limit: 1000MSMemory Limit: 65536KDescriptionBessie has been hired to build a cheap internet network among Farmer John’s N (2 <= N <= 1,000) barns that are convenie...原创 2019-08-13 10:31:56 · 397 阅读 · 0 评论