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

using namespace std;

unordered_map<int,int> hist;
vector<int> to_del;

int main()
{
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        int a;
        cin>>a;
        hist[a]++;
    }
    for(int k=1; k<=n; k++)
    {
        int s=0;
        for(auto p:hist)
        {
            s+=p.second/k;
            if(p.second<k)
                to_del.push_back(p.first);
        }
        for(int i:to_del)
            hist.erase(i);
        to_del.clear();
        cout<<s*k<<" ";
    }
}