1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<bits/stdc++.h>
using namespace std;
using ll=long long;

void solve(){
	int n;
	cin>>n;
	vector<int>a(n),cnt(n,0);
	for(int&i:a)cin>>i;
	sort(a.begin(),a.end());
	int cs=0;
	++cnt[cs];
	for(int i=1;i<n;++i){
		if(a[i]!=a[i-1])++cs;
		++cnt[cs];
	}
	cnt.resize(cs+1);
	sort(cnt.begin(),cnt.end());

	ll pref=0;
	bool ok=0;
	for(int i=1,j=0;i<=n;++i){
		if(ok){
			cout<<0<<' ';
			continue;
		}
		while(cnt[j]<i and j<=cs)pref+=cnt[j],++j;
		ll sum=0;
		int j2=j;
		while(j2<=cs)sum+=cnt[j2]%i,++j2;
		cout<<max(0ll,n-pref-sum)<<' ';
		if(!max(0ll,n-pref-sum))ok=1;
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int t=1;
	//cin>>t;
	while(t--)
		solve();
}