
并查集
titi2018815
菜鸟正在一步步成长!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Marked Ancestor Aizu - 2170
题目:Problem F:You are given a treeTthat consists ofNnodes. Each node is numbered from 1 toN, and node 1 is always the root node ofT. Consider the following two operations onT:M v: (Mark) M...原创 2019-10-12 21:30:17 · 145 阅读 · 0 评论 -
Find them, Catch them POJ - 1703
题目:The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify wh...原创 2019-10-12 20:43:41 · 175 阅读 · 0 评论 -
Play on Words UVA - 10129 (欧拉回路)
题目:Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very...原创 2019-10-04 11:48:47 · 176 阅读 · 0 评论 -
(甲)1013 Battle Over Cities (25 分)(并查集)
题目:It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if w...原创 2019-05-18 16:40:07 · 1294 阅读 · 5 评论 -
蓝桥杯 历届试题 发现环(并查集+路径搜索)
题目: 小明的实验室有N台电脑,编号1~N。原本这N台电脑之间有N-1条数据链接相连,恰好构成一个树形网络。在树形网络上,任意两台电脑之间有唯一的路径相连。 不过在最近一次维护网络时,管理员误操作使得某两台电脑之间增加了一条数据链接,于是网络中出现了环路。环路上的电脑由于两两之间不再是只有一条路径,使得这些电脑上的数据传输出现了BUG。 为了恢复正常传输。小明需要找到所有在环路上的电脑...原创 2019-05-20 21:16:30 · 532 阅读 · 0 评论 -
历届试题 合根植物
题目: w星球的一个种植园,被分成 m * n 个小格子(东西方向m行,南北方向n列)。每个格子里种了一株合根植物。 这种植物有个特点,它的根可能会沿着南北或东西方向伸展,从而与另一个格子的植物合成为一体。 如果我们告诉你哪些小格子间出现了连根现象,你能说出这个园中一共有多少株合根植物吗?输入格式 第一行,两个整数m,n,用空格分开,表示格子的行数、列数(1<m,n&l...原创 2019-05-14 21:34:20 · 210 阅读 · 0 评论 -
历届试题 国王的烦恼 (并查集)
题目: C国由n个小岛组成,为了方便小岛之间联络,C国在小岛间建立了m座大桥,每座大桥连接两座小岛。两个小岛间可能存在多座桥连接。然而,由于海水冲刷,有一些大桥面临着不能使用的危险。 如果两个小岛间的所有大桥都不能使用,则这两座小岛就不能直接到达了。然而,只要这两座小岛的居民能通过其他的桥或者其他的小岛互相到达,他们就会安然无事。但是,如果前一天两个小岛之间还有方法可以到达,后一天却不能到...原创 2019-05-19 11:26:35 · 345 阅读 · 0 评论 -
B - 小希的迷宫
题目:上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮...原创 2018-08-09 12:03:14 · 224 阅读 · 0 评论 -
E - Is It A Tree?
题目: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. T...原创 2018-08-09 12:22:31 · 294 阅读 · 0 评论 -
A - Ice_cream's world I
题目:ice_cream's world is a rich country, it has many fertile lands. Today, the queen of ice_cream wants award land to diligent ACMers. So there are some watchtowers are set up, and wall between watch...原创 2018-08-13 10:01:13 · 223 阅读 · 0 评论