并查集
文章平均质量分 69
Cworld2017
这个作者很懒,什么都没留下…
展开
-
E - Cube Stacking
Farmer John and Betsy are playing a game with N (1 <= N <= 30,000)identical cubes labeled 1 through N. They start with N stacks, each containing a single cube. Farmer John asks Betsy to perform P (1<=原创 2017-09-04 14:48:01 · 308 阅读 · 0 评论 -
B - 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.Th原创 2017-09-05 10:08:07 · 296 阅读 · 0 评论 -
D - Find them, Catch them
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 which g原创 2017-09-05 20:52:37 · 392 阅读 · 0 评论 -
P - Dragon Balls
Five hundred years later, the number of dragon balls will increase unexpectedly, so it's too difficult for Monkey King(WuKong) to gather all of the dragon balls together.His country has N ci原创 2017-09-06 16:36:22 · 303 阅读 · 0 评论 -
食物链 并查集加权
动物王国中有三类动物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-08-28 10:14:51 · 528 阅读 · 0 评论