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
#include<bits/stdc++.h>
#define LL long long
#define LLL __int128
#define uint unsigned
#define ldb long double
#define uLL unsigned long long
using namespace std;
const int N=3e5+5;
int n,a[N],s[N];map<int,int>b;
signed main(){
    cin.tie(0)->sync_with_stdio(0);
    cin>>n;
    for(int i=1;i<=n;++i){
        int v;cin>>v;++b[v];
    }
    for(auto [x,y]:b)++a[y];
    for(int i=n;i;--i)s[i]=s[i+1]+a[i];
    for(int i=1;i<=n;++i){
        int z=0;
        for(int j=i;j<=n;j+=i)z+=s[j];
        cout<<z*i<<' ';
    }
    return 0;
}
/*

*/