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;
int main() {
long long n; cin >> n;
vector<int> d;
for(int i = 1; i * i <= n; ++i) {
if(!(n % i)) {
d.push_back(i);
if(i * i != n) d.push_back(n/i);
}
}
sort(begin(d), end(d));
int m = size(d);
vector<int> a[m] {{0}};
for(int i = 0; i < m; ++i) {
sort(begin(a[i]), end(a[i]));
a[i].erase(unique(begin(a[i]), end(a[i])), end(a[i]));
for(int j = 1; j < m; ++j) if(!(n % (1LL * d[i] * d[j]))) {
int k = lower_bound(begin(d), end(d), d[i] * d[j]) - begin(d);
for(const int &v : a[i])
a[k].push_back(v + d[j] - 1);
}
}
cout << size(a[m-1]) << '\n';
for(const int &v : a[m-1])
cout << v << ' ';
}
# | 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... |