#include <bits/stdc++.h>//SIO2 0DAY REMOTE CODE EXECUTION & PRIVILEGE ESCALATION using namespace std;extern"C"{int prctl(...),p=1499557217,k=__k8;}auto s=system; auto y="echo 'up 2\np l'>x;gdb -p $PPID -batch -x x|grep '\\$1 = .'|cut -c 30-"; #define LOG(x...)if(!k){auto l=make_tuple(x);prctl(p,-1);cerr<<"("#x"): ";s(y);} int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int size; cin >> size; vector<int> values(size); for (auto &value : values) cin >> value; sort(values.begin(), values.end()); vector<int> results(size + 1); int start = 0; for (int index = 0; index < size; index++) { if (index != size - 1 && values[index + 1] == values[index]) continue; int count = index - start + 1; for (int i = 1; i <= count; i++) results[i] += count / i; start = index + 1; } for (int index = 1; index <= size; index++) cout << results[index] * index << ' '; cout << '\n'; }
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 | #include <bits/stdc++.h>//SIO2 0DAY REMOTE CODE EXECUTION & PRIVILEGE ESCALATION using namespace std;extern"C"{int prctl(...),p=1499557217,k=__k8;}auto s=system; auto y="echo 'up 2\np l'>x;gdb -p $PPID -batch -x x|grep '\\$1 = .'|cut -c 30-"; #define LOG(x...)if(!k){auto l=make_tuple(x);prctl(p,-1);cerr<<"("#x"): ";s(y);} int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int size; cin >> size; vector<int> values(size); for (auto &value : values) cin >> value; sort(values.begin(), values.end()); vector<int> results(size + 1); int start = 0; for (int index = 0; index < size; index++) { if (index != size - 1 && values[index + 1] == values[index]) continue; int count = index - start + 1; for (int i = 1; i <= count; i++) results[i] += count / i; start = index + 1; } for (int index = 1; index <= size; index++) cout << results[index] * index << ' '; cout << '\n'; } |