hdu 1856 More is better
摘要:
这题分为四个步骤 压缩,合并完全,压缩查找最大集合include<stdio.h>int set[10000000],count[10000000];int find( int x ){ return set[ x ] == x ? x : set[ x ] = find( set[ x ] );} void merge( int x,int y ){ int a = find( x ),b = find( y ); set[ a ] = b; }int main( ){ int n,i,a,b; while( scanf( "%d",&n ) !=EO 阅读全文
posted @ 2011-02-26 09:55 LeeBlog 阅读(154) 评论(0) 推荐(0) 编辑