#include <bits/stdc++.h>
using namespace std;
#define fwd(i, a, n) for (int i = (a); i < (n); i ++)
#define rep(i, n) fwd(i, 0, n)
#define all(X) begin(X), end(X)
#define sz(X) ((int)X.size())
#define st first
#define nd second
#define pii pair<int, int>
#define vi vector<int>
#ifdef LOC
auto &operator << (auto &out, pair<auto, auto> a) {
return out << "(" << a.st << ", " << a.nd << ")";
}
auto &operator << (auto &out, auto a) {
out << "{";
for (auto b : a)
out << b << ", ";
return out << "}";
}
void dump(auto... x) { ((cerr << x << ", "), ...) << '\n'; }
#define debug(x...) cerr << "[" #x "]: ", dump(x)
#else
#define debug(...) 0
#endif
#define my_getchar() (S == T && (T = (S = BB) + fread_unlocked(BB, 1, 1 << 15, stdin), S == T) ? EOF : *S++)
char BB[1 << 20], *S = BB, *T = BB;
inline void read(int &x) {
x = 0;
char c = my_getchar();
while (isdigit(c)) {
x = 10 * x + (c & 15);
c = my_getchar();
}
}
int32_t main() {
int n;
read(n);
map<int, int> a;
rep(i, n) {
int x;
read(x);
a[x] += 1;
}
vi ans(n + 1, 0);
for (auto [_, k] : a) {
fwd(i, 1, k + 1) {
ans[i] += k - k % i;
}
}
fwd(i, 1, n + 1)
printf("%d ", ans[i]);
printf("\n");
return 0;
}
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 56 57 58 59 60 61 62 | #include <bits/stdc++.h> using namespace std; #define fwd(i, a, n) for (int i = (a); i < (n); i ++) #define rep(i, n) fwd(i, 0, n) #define all(X) begin(X), end(X) #define sz(X) ((int)X.size()) #define st first #define nd second #define pii pair<int, int> #define vi vector<int> #ifdef LOC auto &operator << (auto &out, pair<auto, auto> a) { return out << "(" << a.st << ", " << a.nd << ")"; } auto &operator << (auto &out, auto a) { out << "{"; for (auto b : a) out << b << ", "; return out << "}"; } void dump(auto... x) { ((cerr << x << ", "), ...) << '\n'; } #define debug(x...) cerr << "[" #x "]: ", dump(x) #else #define debug(...) 0 #endif #define my_getchar() (S == T && (T = (S = BB) + fread_unlocked(BB, 1, 1 << 15, stdin), S == T) ? EOF : *S++) char BB[1 << 20], *S = BB, *T = BB; inline void read(int &x) { x = 0; char c = my_getchar(); while (isdigit(c)) { x = 10 * x + (c & 15); c = my_getchar(); } } int32_t main() { int n; read(n); map<int, int> a; rep(i, n) { int x; read(x); a[x] += 1; } vi ans(n + 1, 0); for (auto [_, k] : a) { fwd(i, 1, k + 1) { ans[i] += k - k % i; } } fwd(i, 1, n + 1) printf("%d ", ans[i]); printf("\n"); return 0; } |
English