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"
#define int long long
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> f;
for (int i = 1; i * i <= n; ++i) {
if (n % i) continue;
f.push_back(i);
if (n / i != i) {
f.push_back(n / i);
}
}
sort(f.begin(), f.end());
vector<set<int>> se(f.size());
unordered_map<int, int> mp;
for (int i = 0; i < (int) f.size(); ++i) {
mp[f[i]] = i;
}
se[0].insert(0);
for (int i = 0; i < (int) f.size(); ++i) {
for (int j = 0; j < i; ++j) {
if (f[i] % f[j]) continue;
int author = f[i] / f[j];
for (int k : se[j]) {
for (int l : se[mp[author]]) {
se[i].insert(k + l);
}
}
}
se[i].insert(f[i] - 1);
}
cout << se.back().size() << '\n';
for (int i : se.back()) {
cout << i << ' ';
}
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... |