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
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin>>n;
    vector<int> v;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        v.push_back(x);
    }
    vector <int> s(n+1,0);
    set<int> sec;
    sort(v.begin(),v.end());
    int pp=1;
    for(int i=1;i<n;i++)
    {
        if(v[i]==v[i-1])
            pp++;
        else
        {
            s[pp]++;
            sec.insert(pp);
            pp=1;
        }
    }
    if(v.size()>=2 && v[n-1]==v[n-2])
    {
        s[pp]++;
        sec.insert(pp);
    }

    if(v.size()>=2 && v[n-1]!=v[n-2])
    {
        s[1]++;
        sec.insert(1);
    }

    //for(int i=0;i<s.size();i++)
        //cout<<s[i];
    //cout<<endl;
    for(int k=1;k<=n;k++)
    {
        int wynik=n;
        for(auto it=sec.begin();it!=sec.end();it++)
        {
            //cout<<*it;
            //cout<<k<<" "<<*it<<" ";
            wynik-=(s[*it]*(*it%k));
            //cout<<wynik<<endl;
        }
        cout<<wynik<<" ";
    }
    cout<<"\n";
    //cout<<0%23;
}