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
#include <cstdio>
#include <unordered_map>

#define MAX 300200
using namespace std;

int n;
int buf[MAX];

unordered_map<int,int> c,c2;

int main() {
    scanf("%d", &n);

    for(int i=0;i<n;i++) {
        scanf("%d", &buf[i]);
        c[buf[i]]+=1;
    }

    for (auto v: c) c2[v.second]+=1;
    
    for(int k=1;k<=n;k++) {
        int result = 0;
        for (auto v: c2) {
            result += v.second * (v.first/k)*k;
        }
        printf("%d ", result);
    }
    printf("\n");
}