并查集
UCPRER
这个作者很懒,什么都没留下…
展开
-
Constructing Roads(最小生成树) POJ 2421
POJ 2421There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and ...原创 2018-12-04 16:25:42 · 227 阅读 · 0 评论 -
Destroying Array(并查集)CodeForces-722C
Destroying ArrayDescriptionYou are given an array consisting of n non-negative integers a1, a2, …, an.You are going to destroy integers in the array one by one. Thus, you are given the permutation ...原创 2018-12-11 16:31:14 · 163 阅读 · 0 评论 -
食物链(带权并查集)POJ1182
POJ1182Description动物王国中有三类动物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-12-11 14:46:38 · 155 阅读 · 0 评论