![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
文章平均质量分 58
浮生一朝
这个作者很懒,什么都没留下…
展开
-
食物链 POJ - 1182(并查集)
动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是”1 X Y”,表示X和Y是同类。 第二种说法是”2 X Y”,表示X吃Y。 此人对N个动物,用上述两种说法,一句接一句地说原创 2018-01-24 10:43:44 · 211 阅读 · 0 评论 -
L2-010. 排座位(并查集)
布置宴席最微妙的事情,就是给前来参宴的各位宾客安排座位。无论如何,总不能把两个死对头排到同一张宴会桌旁!这个艰巨任务现在就交给你,对任何一对客人,请编写程序告诉主人他们是否能被安排同席。输入格式:输入第一行给出3个正整数:N(<= 100),即前来参宴的宾客总人数,则这些人从1到N编号;M为已知两两宾客之间的关系数;K为查询的条数。随后M行,每行给出一对宾客之间的关系,格式为:“宾客...原创 2018-03-13 10:33:57 · 194 阅读 · 0 评论 -
A - Union of Doubly Linked Lists CodeForces - 847A(并查集)
Doubly linked list is one of the fundamental data structures. A doubly linked list is a sequence of elements, each containing information about the previous and the next elements of the list. In this原创 2017-11-22 11:43:15 · 367 阅读 · 0 评论 -
Is It A Tree? POJ - 1308(并查集判断是否为树)
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原创 2018-01-29 10:39:53 · 240 阅读 · 0 评论 -
G - Por Costel and the Match Gym - 100923H(种类并查集)
G - Por Costel and the Match Gym - 100923HOberyn Martell and Gregor Clegane are dueling in a trial by combat. The fight is extremely important, as the life of Tyrion Lannister is on the line. Oberyn原创 2018-01-28 20:44:48 · 502 阅读 · 0 评论 -
小希的迷宫 HDU - 1272 (并查集)
上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的原创 2018-01-27 11:28:38 · 503 阅读 · 0 评论 -
A Bug's Life POJ - 2492(种类并查集)
A Bug’s Life POJ - 2492 Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with原创 2018-01-27 10:14:27 · 319 阅读 · 0 评论 -
Parity game POJ - 1733(并查集加离散化)
Parity game POJ - 1733(并查集加离散化)与POJ的食物链题同理 Now and then you play the following game with your friend. Your friend writes down a sequence consisting of zeroes and ones. You choose a continuous subse原创 2018-01-25 15:49:36 · 339 阅读 · 0 评论 -
POJ 1456 Supermarket (贪心+并查集)
DescriptionA supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the原创 2018-01-24 11:56:19 · 324 阅读 · 0 评论 -
L3-1 社交集群(30 分)(并查集)
当你在社交网络平台注册时,一般总是被要求填写你的个人兴趣爱好,以便找到具有相同兴趣爱好的潜在的朋友。一个“社交集群”是指部分兴趣爱好相同的人的集合。你需要找出所有的社交集群。 输入格式:输入在第一行给出一个正整数 N(≤1000),为社交网络平台注册的所有用户的人数。于是这些人从 1 到 N 编号。随后 N 行,每行按以下格式给出一个人的兴趣爱好列表:Ki: hi[1] h...原创 2018-03-26 16:50:26 · 1377 阅读 · 0 评论