# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975335 | IBory | Toys (CEOI18_toy) | C++17 | 1138 ms | 139220 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MAX = 222222;
vector<int> D, S[MAX];
int main() {
int N;
cin >> N;
for (int i = 1; i * i <= N; ++i) {
if (N % i) continue;
D.push_back(i);
if (i * i != N) D.push_back(N / i);
}
sort(D.begin(), D.end());
S[0].push_back(0);
for (int i = 0; i < D.size(); ++i) {
sort(S[i].begin(), S[i].end());
S[i].erase(unique(S[i].begin(), S[i].end()), S[i].end());
for (int j = i + 1; j < D.size(); ++j) {
if (D[j] % D[i]) continue;
for (int n : S[i]) S[j].push_back(n + D[j] / D[i] - 1);
}
}
cout << S[D.size() - 1].size() << '\n';
for (int n : S[D.size() - 1]) cout << n << ' ';
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |