提交时间:2024-01-03 13:08:15
运行 ID: 118998
#include<bits/stdc++.h> using namespace std; int maxn=-1,n,m,i,j,ans[11],tmp; inline int read(){ int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar(); return x*f; } int main(){ n=read(); m=read(); int nm=n*m; ans[1]=nm; for(i=1;i<=nm;i++){ tmp=read(); maxn=max(maxn,tmp); while(tmp>=2){ ans[tmp]++; tmp--; } } cout<< maxn<<endl; for(i=1;i<=maxn;i++) cout<<ans[i]<<endl; return 0; }