锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产精品综合久久网络,精品综合久久久久久97,免费一级欧美大片久久网http://www.shnenglu.com/vontroy/archive/2010/07/29/121521.htmlVontroyVontroyWed, 28 Jul 2010 23:09:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/07/29/121521.htmlhttp://www.shnenglu.com/vontroy/comments/121521.htmlhttp://www.shnenglu.com/vontroy/archive/2010/07/29/121521.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/121521.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/121521.html#include <iostream>
#include 
<cstdio>

const int maxn = 30000 + 5;

using namespace std;

int father[maxn],rank[maxn];

void init( int n )
{
    
for ( int i = 0; i < n; i++)
    {
        father[i] 
= i;
        rank[i] 
= 1;
    }
}

int findSet( int n )
{
    
if(father[n] != n)
        father[n] 
= findSet(father[n]);
    
return father[n];
}

void Union( int a, int b )
{
    
int x = findSet( a );
    
int y = findSet( b );

    
if( x == y ) return ;
    
if( rank[x] >= rank[y] )
    {
        father[y] 
= x;
        rank[x] 
+= rank[y];
    }
    
else
    {
        father[x] 
= y;
        rank[y] 
+= rank[x];
    }
}

int main()
{
    
int m, n, count, temp, first;
    
while~scanf("%d%d"&n, &m ) && n )
    {
        init(n);
        
while( m-- )
        {
            scanf(
"%d%d"&count, &first );
            
forint i = 1; i < count ;i ++)
            {
                scanf(
"%d"&temp);
                Union( first, temp );
            }
        }
        printf(
"%d\n",rank[findSet(0)]);
    }
    
return 0;
}


Vontroy 2010-07-29 07:09 鍙戣〃璇勮
]]>
HDU 1198 Farm Irrigationhttp://www.shnenglu.com/vontroy/archive/2010/07/29/121520.htmlVontroyVontroyWed, 28 Jul 2010 23:04:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/07/29/121520.htmlhttp://www.shnenglu.com/vontroy/comments/121520.htmlhttp://www.shnenglu.com/vontroy/archive/2010/07/29/121520.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/121520.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/121520.html#include<iostream>
using namespace std;

int bin[2500];

int find(int x)
{
return x==bin[x]?x:find(bin[x]);}

void merge(int x,int y)
{
    x
=find(x);
    y
=find(y);
    
if(x!=y) bin[x]=y;
}

int main()
{
    
int a[11= {93126510111314715}, m, n, i, j, map[50][50], total;
    
char c;
    
while(scanf("%d %d"&m, &n), m != -1 || n != -1){
        getchar();
        
for(i = 0; i < m; ++i){
            
for(j = 0; j < n; ++j){
                scanf(
"%c"&c);
                map[i][j] 
= c - 65;
            }
            getchar();
        }
        
for(i = 0; i < m * n; ++i) bin[i] = i;
        
for(i = 0; i < m; ++i)
            
for(j = 0; j < n; ++j){
                
if(i + 1 < m && a[map[i][j]] & 0x04 && a[map[i + 1][j]] & 0x01)
                    merge(i 
* n + j, i * n + n + j);
                
if(j + 1 < n && a[map[i][j]] & 0x02 && a[map[i][j + 1]] & 0x08)
                    merge(i 
* n + j, i * n + j + 1);
            }
        
for(total = 0, i = 0; i < m * n; ++i)
            
if(i == bin[i]) ++total;
        printf(
"%d\n", total);
    }
    
return 0;
}


Vontroy 2010-07-29 07:04 鍙戣〃璇勮
]]>
久久成人国产精品| 日本亚洲色大成网站WWW久久| 久久婷婷五月综合成人D啪| 久久久久亚洲av成人网人人软件| 一本一本久久A久久综合精品| 韩国免费A级毛片久久| 久久国产三级无码一区二区| 亚洲中文字幕久久精品无码喷水| 国产日产久久高清欧美一区| 久久国产AVJUST麻豆| 久久99热狠狠色精品一区| 伊人久久大香线蕉无码麻豆| 777米奇久久最新地址| 无码八A片人妻少妇久久| 国产福利电影一区二区三区,免费久久久久久久精 | 久久综合视频网站| 欧美一区二区三区久久综合| 欧洲国产伦久久久久久久| 97久久久久人妻精品专区| 精品久久久久久久国产潘金莲| 国产精品久久波多野结衣| 中文字幕精品无码久久久久久3D日动漫 | 久久香蕉一级毛片| 欧美成人免费观看久久| 国产成人精品白浆久久69| 亚洲午夜久久久| 久久精品国产亚洲精品| 久久婷婷久久一区二区三区| 香蕉久久夜色精品升级完成| 性做久久久久久免费观看| 99久久亚洲综合精品成人| 久久青青草原国产精品免费| 久久精品国产亚洲av水果派| 久久人人爽人人人人爽AV| 久久久这里只有精品加勒比| 亚洲成av人片不卡无码久久| 久久国产精品二国产精品| 国产巨作麻豆欧美亚洲综合久久| 97久久精品无码一区二区| 久久本道伊人久久| 久久这里只精品国产99热|