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>
#define int long long
using namespace std;


int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    for(int i = 0; i < n; i++)
        cin >> a[i];
    sort(a.begin(), a.end());
    vector <int> sumans(n+1);
    vector <int> c;
    c.push_back(1);
    for(int i = 1; i < n; i++){
        if(a[i-1] == a[i])
            c[c.size()-1]++;
        else
            c.push_back(1);
    }
    vector <int> rans(n);
    for(auto x: c)
    {
        for(int j = 1; j <= x; j++){
            rans[j-1] += x/j*j;
        }
    }
    for(int x: rans)
        cout << x << " ";
    return 0;
}