Start: Feb, 21, 2019 12:00:00
2018-2019 ACM集训队冬季集训第二次考核
End: Feb, 21, 2019 17:00:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 55ms
Memory: 9524kB
Author: 2017212212237
In contest: 1261

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<queue>
#include<vector>
using namespace std;

#define ll long long
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
/*
char str[20][5] ={"063","010","093","079","106","103","119","011","127","107"};
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		char a[maxn];
		scanf("%s",a);
		int len = strlen(a);
		int pos;
		for(int i=0;i<len;i++)
			if(a[i] == '+')
				pos = i;
		//cout<<pos<<endl;		
		int x = 0;		
		for(int i=0;i<pos;i = i+3)
		{
			x = x*10;
			for(int j = 0;j<=9;j++)
			{
				if(a[i] == str[j][0] && a[i+1] == str[j][1] && a[i+2] == str[j][2])
				{
					int tmp = j;
					x += tmp;
					break;
				}
			}		
		}
		
		int y = 0;		
		for(int i=pos+1;i<len-1;i = i+3)
		{
			y = y*10;
			for(int j = 0;j<=9;j++)
			{
				if(a[i] == str[j][0] && a[i+1] == str[j][1] && a[i+2] == str[j][2])
				{
					int tmp = j;
					y += tmp;
					break;
				}
			}		
		}
		//printf("%d %d",x,y);
		for(int i=0;i<len;i++)
			printf("%c",a[i]);
		int ans = x + y;
	//	cout<<ans<<endl;
		int num[maxn];
		int wei = 0;
		while(ans)
		{
			num[wei] = ans % 10;
			wei++;
			ans /= 10;	
		}	
		for(int i=wei-1;i>=0;i--)
		{
			for(int j=0;j<3;j++)
				printf("%c",str[num[i]][j]);
		}
		printf("\n");
	}
}
*/

int n,m;
int par[maxn];
int rk[maxn];
int find(int x)
{
	if(par[x] == x)
		return x;
	else 
	return par[x] = find(par[x]);
}

void combine(int x,int y)
{
	int fx = find(x);
	int fy = find(y);
	if(fx != fy)
	{
		par[fy] = fx;
		rk[fx] += rk[fy];
	}
}
int main()
{
	while(~scanf("%d %d",&n,&m))
	{
		for(int i=1;i<=n;i++)
			rk[i] = 1;
		for(int i=1;i<=n;i++)
			par[i] = i;	
		for(int i=0;i<m;i++)
		{
			int a,b;
			scanf("%d %d",&a,&b);
			combine(min(a,b),max(a,b));
		}
		int maxx = 0;
		for(int i=1;i<=n;i++){
			//printf("%d %d\n",i,rk[i]);
			maxx = max(maxx,rk[i]);
		}
		
		printf("%d\n",maxx);	
	}
}