HDOJ 1856 More is better (并查集)
HDOJ 1856 More is better (并查集) 求 所有 根节点中 ,集合中元素最多的个数。
In the first sample {1,2,5,6} is the result. , 最多为 4 ;
In the second sample {1,2},{3,4},{5,6},{7,8} are four kinds of answers. , 最多的是 2 。
注意: 压缩路径 否则超时,不能AC ; N为 0 ,要输出
原创
2015-08-18 15:08:02 ·
437 阅读 ·
0 评论