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

int main()
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);  
  int n;
  std::cin >> n;
  std::vector<int> cities(n);
  for (int i = 0; i < n; ++i)
    std::cin >> cities[i];

  std::map<int, unsigned int> stamp_cnt;
  for (int i = 0; i < n; ++i)
    stamp_cnt[cities[i]]++;

  std::vector<unsigned int> vec;
  for (std::map<int, unsigned int>::iterator iter = stamp_cnt.begin(); 
       iter != stamp_cnt.end(); iter++)
  {
    vec.push_back(iter->second);
  }  
  unsigned int given = 0;
  for (unsigned int j = 0; j < vec.size(); j++)
    given += vec[j];
  std::cout << given;
  unsigned int i; // Liczba chętnych.
  for (i = 2; i <= n && given > 0; i++) 
  {
    given = 0;
    for (unsigned int j = 0; j < vec.size(); j++)
      given += (vec[j] / i) * i;
    std::cout << " " << given;
  }
  for (; i <= n; i++) 
    std::cout << " 0";

  std::cout << "\n";
  // system("pause");
  return 0;
}