#include<bits/stdc++.h>
using namespace std;
vector<int> E[200005];
int n,m,ans,cnt;
int ANS[100005];
bool noneed[200005];
queue<int> Q,Q2;
int read(){
int ret=0;
while(1){
char ch=getchar();
if(ch>='0'&&ch<='9') ret*=10,ret+=ch-'0';
else return ret;
}
}
void work(int x){
int ans2=0;
while(!Q.empty()) Q.pop();
Q.push(x);
bool f=1;
while(!Q.empty()){
int now=Q.front();
memset(noneed,0,sizeof(noneed));
for(int i=0;i<E[now].size();i++) noneed[E[now][i]]=1;
int siz_now=Q2.size();
while(siz_now--){
int a=Q2.front();Q2.pop();
if(noneed[a]) Q2.push(a);
else Q.push(a);
}
Q.pop();ans2++;
}
ans++;
ANS[++cnt]=Q.size()+ans2;
//cout<<endl<<endl;
}
signed main(){
n=read(),m=read();
for(int i=1;i<=m;i++){
int x,y;x=read(),y=read();
E[x].push_back(y);E[y].push_back(x);
}
for(int i=1;i<=n;i++) Q2.push(i);
while(!Q2.empty()){
int x=Q2.front();Q2.pop();
work(x);
}
cout<<ans<<endl;
sort(ANS+1,ANS+cnt+1);
for(int i=1;i<=cnt;i++){
cout<<ANS[i]<<' ';
}
}
这个是看着第二篇题解的文字写的,据说复杂度十分优秀,但是我卡常数之前T三个点我是不是写错了啊。还有为什么卡常数可以缩到四分之一?我比赛不带卡常数的,是不是要改了