
数据结构-并查集
wind_bow
.。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【hdu1213】 How Many Tables 【并查集】
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 friends know each other, a...原创 2018-07-24 20:43:51 · 113 阅读 · 0 评论 -
带权并查集
带权并查集 上次计科院赛D题,种类并查集做的自闭,看了几天,终于搞懂了~~~~ 真开心,好像会了 并查集就不多说了嘛,基本的谁都会 建立并查集的 father数组(存放当前节点所在集合代表元素编号) 和 dist数组(存放当前节点到所在集合表表元素的关系) 时,需要用编号对所有字符串唯一标记,方便与 father 数组 和 dist 数组中的各元素唯一对应。此时用string类...原创 2018-12-19 16:15:44 · 190 阅读 · 0 评论 -
hdu 1325/poj 1308 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. There i...原创 2018-11-30 10:59:45 · 174 阅读 · 0 评论 -
POJ1182食物链 种类并查集
动物王国中有三类动物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个动物,用上述两种说法,一句接一句地说出K句话,这K句话...原创 2019-01-05 20:53:09 · 196 阅读 · 0 评论 -
poj-1182 食物链 并查集
食物链 poj-1182 题面: 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表...转载 2018-12-21 13:34:33 · 165 阅读 · 0 评论 -
codeforces 1131 F. Asya And Kittens
F. Asya And Kittens http://codeforces.com/contest/1131/problem/F time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Asya loves anim...原创 2019-02-24 16:00:26 · 411 阅读 · 0 评论 -
codeforces 1131 D Gourmet choice (并查集缩点 拓扑排序)
D. Gourmet choice http://codeforces.com/problemset/problem/1131/D time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mr. Apple, a g...原创 2019-03-01 15:10:28 · 287 阅读 · 0 评论