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
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

int main()
{
    int n, l, li, out, ll;
    scanf("%d", &n);
    vector<int> v1;
    vector<int> v2 ;
    for(int i = 0; i < n; i++){
        v1.push_back(0);
        v2.push_back(0);
    }
    for(int i = 0; i < n; i++){
        scanf("%d", &l);
        if(l == ll){
            v2[li]++;
            continue;
        }
        for (int j = 0; j < n; j++) {
            if (v1[j] == 0 || v1[j] == l) {
                li = j;
                break;
            }
        }
        v1[li] = l;
        v2[li]++;
        ll = l;
    }
    bool end = false;
    printf("%d ", n);
    for(int i = 2; i <= n; i++){
        out = 0;
        if(end){
            printf("0 ");
            continue;
        }
        for(int j = 0; j < n; j++){
            if(v1[j] == 0){
                break;
            }
            if(v2[j] >= i){
                out += (v2[j] / i)*i;
            }
        }
        if(out == 0){
            end = true;
        }
        printf("%d ", out);
    }
    return 0;
}