
并查集
文章平均质量分 70
Jane-Young
这个作者很懒,什么都没留下…
展开
-
POJ 1611 The Suspects
Description Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best s原创 2013-11-15 10:18:06 · 713 阅读 · 0 评论 -
POJ 1308 Is It A Tree?
Description 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 proper原创 2013-11-15 10:18:08 · 786 阅读 · 0 评论 -
hdu 1811 Rank of Tetris
题目: http://acm.hdu.edu.cn/showproblem.php?pid=1811 这题的关键点就是对 “=” 的处理,这个要用到并查集。把是“=”关系的点放在统一集合内,处理其中每一个点时都当做处理根结点。 数据不全的情况是同时出现两个点的入度为0,(当两个点具有“ = ”关系时,我们默认是一个点)。 源代码: 1 #include 2 #include原创 2013-11-15 10:19:05 · 713 阅读 · 0 评论 -
POJ 1128 食物链
Description 动物王国中有三类动物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个动物,用上述两种说法,一原创 2013-11-15 10:18:04 · 779 阅读 · 0 评论