![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
FGTdr
你微不足道,一无是处!
展开
-
POJ 1988 Cube stacking
题目如下: Sample Input 6 M 1 6 C 1 M 2 4 M 2 6 C 3 C 4 Sample Output 1 0 2 有N(N<=30,000)堆方块,开始每堆都是一个方块 方块编号1 – N. 有两种操作 M x y :表示把方块x所在的堆,拿起来叠放到y 所在的堆上 C x : 问方块x下面有多少个方块 操作最多有 P (P<=100,000)次 对每次C...原创 2018-11-16 11:42:59 · 83 阅读 · 0 评论 -
poj 食物链
动物王国中有三类动物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句话,这...原创 2018-11-16 11:52:08 · 234 阅读 · 0 评论 -
poj A bug's life
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 bugs of the opposite gende...原创 2018-11-16 12:00:36 · 178 阅读 · 0 评论