OrzCDQ您太强辣
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#define inf 0x7fffffff
#define ll long long
using namespace std;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch>''||ch<''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int n,m,cnt,ans;
int head[],d[],q[],col[],hash[];
bool vis[];
struct data{int to,next;}e[];
void ins(int u,int v)
{e[++cnt].to=v;e[cnt].next=head[u];head[u]=cnt;}
int main()
{
n=read();m=read();
for(int i=;i<=m;i++)
{
int u=read(),v=read();
ins(u,v);ins(v,u);
}
for(int i=n;i;i--)
{
int t=;
for(int j=;j<=n;j++)
{
if(!vis[j]&&d[j]>=d[t])t=j;
}
vis[t]=;q[i]=t;
for(int j=head[t];j;j=e[j].next)
d[e[j].to]++;
}
for(int i=n;i>;i--)
{
int t=q[i];
for(int j=head[t];j;j=e[j].next)hash[col[e[j].to]]=i;
int j;
for(j=;;j++)if(hash[j]!=i)break;
col[t]=j;
if(j>ans)ans=j;
}
printf("%d",ans);
return ;
}