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;
long long X;
set<long long> ans;
unordered_set<long long> s;
void f(long long n, long long sum) {
s.insert(n*1000000000+sum);
ans.insert(sum+n-1);
for (long long i = 2; i*i <= n; ++i) if (n % i == 0 && s.find(n/i*1000000000+sum+i-1) == s.end()) f(n/i,sum+i-1);
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin >> X;
f(X,0);
cout << ans.size() << '\n';
for (auto x: ans) cout << x << ' ';
return 0;
}
# | 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... |