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

int main() {
    int n;
    std::cin >> n;

    std::unordered_map<int, int> city_to_stamps;
    for (int i = 0; i < n; ++i) {
        int in;
        std::cin >> in;
        city_to_stamps[in] += 1;
    }

    std::unordered_map<int, int> stamp_to_counts;
    for (auto [_, stamp]: city_to_stamps) {
        stamp_to_counts[stamp] += 1;
    }

    for (int i = 1; i <= n; ++i) {
        int res = 0;
        for (auto [stamp, count]: stamp_to_counts) {
            res += stamp / i * count;
        }
        std::cout << res * i << " ";
    }
    std::cout << "\n";
}