# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
267157 | ly20 | Toys (CEOI18_toy) | C++17 | 5067 ms | 712 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;
set <int> resp;
void backt(int at, int tot) {
//printf("%d\n", at);
int sq = min((int) sqrt(at) + 10, at);
if(at == 1) {
resp.insert(tot);
return;
}
for(int i = 2; i < sq; i++) {
if(at % i == 0) {
backt(at / i, tot + i - 1);
backt(i, tot + at / i - 1);
}
}
backt(1, tot + at - 1);
}
int main() {
int n;
scanf("%d", &n);
backt(n, 0);
set <int> :: iterator it;
printf("%d\n", resp.size());
for(it = resp.begin(); it != resp.end(); it++) {
printf("%d ", *it);
}
printf("\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... |