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
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	vector<int> V, res;
	int n; cin >> n;
	res.assign(n + 1, 0);

	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		V.push_back(x);
	}
	sort(V.begin(), V.end());

	int cnt = 0;
	for (int i = 1; i < n; i++) {
		cnt++;
		if (V[i] != V[i - 1]) {
			for(int u = 1; cnt/u >= 1; u++) res[cnt/u]++;
			cnt = 0;
		}
	}
	cnt++;
	for(int u = 1; cnt/u >= 1; u++) res[cnt/u]++;

	for (int i = n-1; i >= 0; i--) res[i] += res[i+1]; 
	for (int i = 1; i <= n; i++) cout << res[i] * i << ' '; 

	return 0;
}