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
45
46
47
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
long long m,b,n,odp;
vector <long long> x;
vector <long long> a;
int main()
{
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> m;
        a.push_back(m);
    }
    sort(a.begin(),a.end());
    b=a[0];
    m=1;
    for(int i=1;i<n;++i)
    {
        if(a[i]==b)m++;
        else{
            x.push_back(m);
            b=a[i];
            m=1;
        }
    }
    x.push_back(m);
    sort(x.begin(),x.end());
    cout << n << " ";
    for(int k=2;k<=n;++k)
    {
        odp=0;
        if(k<=x[x.size()-1]){
        for(int i=0;i<x.size();++i)
        {
            if(x[i]>=k){
                b=x[i]%k;
                odp=odp+x[i]-b;
            }
        }
        cout << odp << " ";}
        else cout << odp << " ";
    }
    return 0;
}