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
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5+7;
int cnt[N],sum[N];
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n;
	cin>>n;
	int ptr = 0;
	map<int,int> M;
	for(int i = 1;i<=n;i+=1){
		int val;
		cin>>val;
		if (M.count(val)==0){
			ptr += 1;
			M[val] = ptr;
		}
		cnt[M[val]] += 1;
	}
	for(int i = 1;i<=ptr;i+=1){
		for(int j = 1;j<=cnt[i];j+=1){
			sum[j] += cnt[i]-cnt[i]%j;
		}
	}
	for(int i = 1;i<=n;i+=1){
		cout<<sum[i]<<' ';
	}
	cout<<'\n';
}