锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产精品综合久久网络,精品综合久久久久久97,免费一级欧美大片久久网http://m.shnenglu.com/vontroy/archive/2010/07/29/121521.htmlVontroyVontroyWed, 28 Jul 2010 23:09:00 GMThttp://m.shnenglu.com/vontroy/archive/2010/07/29/121521.htmlhttp://m.shnenglu.com/vontroy/comments/121521.htmlhttp://m.shnenglu.com/vontroy/archive/2010/07/29/121521.html#Feedback0http://m.shnenglu.com/vontroy/comments/commentRss/121521.htmlhttp://m.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://m.shnenglu.com/vontroy/archive/2010/07/29/121520.htmlVontroyVontroyWed, 28 Jul 2010 23:04:00 GMThttp://m.shnenglu.com/vontroy/archive/2010/07/29/121520.htmlhttp://m.shnenglu.com/vontroy/comments/121520.htmlhttp://m.shnenglu.com/vontroy/archive/2010/07/29/121520.html#Feedback0http://m.shnenglu.com/vontroy/comments/commentRss/121520.htmlhttp://m.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 鍙戣〃璇勮
]]>
免费精品99久久国产综合精品| 久久se精品一区二区| 三级三级久久三级久久| 亚洲午夜无码久久久久小说| 日产精品99久久久久久| 久久亚洲国产欧洲精品一| 思思久久99热免费精品6| 国产91色综合久久免费| 午夜福利91久久福利| 久久久久久狠狠丁香| 亚洲AV成人无码久久精品老人 | 国产99久久精品一区二区| 久久www免费人成看国产片| 久久天天躁狠狠躁夜夜躁2O2O| 狠狠色综合久久久久尤物| 久久精品国产亚洲av水果派| 国内精品久久久久久不卡影院| 久久香综合精品久久伊人| 久久亚洲精品国产精品婷婷| 91精品国产91久久| 久久久久久久亚洲Av无码| 久久久无码精品亚洲日韩蜜臀浪潮 | 国产成人精品久久综合| 婷婷五月深深久久精品| 狠狠色丁香久久婷婷综合蜜芽五月 | 国产午夜精品久久久久九九| 国内精品久久久久久99蜜桃| 久久久精品久久久久影院| 2021国产成人精品久久| 久久福利青草精品资源站| jizzjizz国产精品久久| 久久久久亚洲精品无码蜜桃| 中文字幕久久久久人妻| 久久天天婷婷五月俺也去| 一级女性全黄久久生活片免费| 人妻丰满?V无码久久不卡| 久久国产乱子伦精品免费午夜| 精品久久久久一区二区三区| 精品国产乱码久久久久久浪潮| 99久久精品费精品国产| 久久精品视屏|