#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
constexpr int maxn = 3e5+5;
int n, wyn[maxn];
map<int,int> cnt;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
int a;
for (int i = 1; i <= n; ++i){
cin >> a;
++cnt[a];
}
for (auto u : cnt){
for (int i = 1; i <= u.s; ++i){
wyn[i] += u.s - u.s%i;
}
}
for (int i = 1; i <= n; ++i)
cout << wyn[i] << ' ';
}
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 | #include <bits/stdc++.h> using namespace std; #define f first #define s second constexpr int maxn = 3e5+5; int n, wyn[maxn]; map<int,int> cnt; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; int a; for (int i = 1; i <= n; ++i){ cin >> a; ++cnt[a]; } for (auto u : cnt){ for (int i = 1; i <= u.s; ++i){ wyn[i] += u.s - u.s%i; } } for (int i = 1; i <= n; ++i) cout << wyn[i] << ' '; } |
English