
并查集
吃货妍
努力学习中
展开
-
并查集&求指出思路为啥WA。。
动物王国中有三类动物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个动物,用上述两种说法,一句接一句地原创 2016-08-04 22:41:42 · 609 阅读 · 2 评论 -
Codeforces Round #396 (Div. 2) D. Mahmoud and a Dictionary(并查集)
D. Mahmoud and a Dictionarytime limit per test:4 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputMahmoud wants to write a new dictionary that contains n words and re原创 2017-02-08 22:04:19 · 313 阅读 · 0 评论 -
8VC Venture Cup 2017 - Elimination RoundC. PolandBall and Forest(并查集)
C. PolandBall and Foresttime limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard outputPolandBall lives in a forest with his family. There are some trees in th转载 2017-01-19 16:42:52 · 771 阅读 · 0 评论