标签:class hid iostream include bzoj long cstring lib inline
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=0,f=1;char ch=getchar(); while(ch>‘9‘||ch<‘0‘){if(ch==‘-‘)f=-1;ch=getchar();} while(ch>=‘0‘&&ch<=‘9‘){x=x*10+ch-‘0‘;ch=getchar();} return x*f; } int n,m,cnt,ans; int head[10005],d[10005],q[10005],col[10005],hash[10005]; bool vis[10005]; struct data{int to,next;}e[2000005]; 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=1;i<=m;i++) { int u=read(),v=read(); ins(u,v);ins(v,u); } for(int i=n;i;i--) { int t=0; for(int j=1;j<=n;j++) { if(!vis[j]&&d[j]>=d[t])t=j; } vis[t]=1;q[i]=t; for(int j=head[t];j;j=e[j].next) d[e[j].to]++; } for(int i=n;i>0;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=1;;j++)if(hash[j]!=i)break; col[t]=j; if(j>ans)ans=j; } printf("%d",ans); return 0; }
标签:class hid iostream include bzoj long cstring lib inline
原文地址:http://www.cnblogs.com/Kong-Ruo/p/7845018.html