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;
void just_do_it();
int main() {
#ifdef KAMIRULEZ
freopen("kamirulez.inp", "r", stdin);
freopen("kamirulez.out", "w", stdout);
#endif
ios_base::sync_with_stdio(0);
cin.tie(0);
just_do_it();
return 0;
}
void just_do_it() {
int n;
cin >> n;
vector<int> facts;
for (int i = 1; i * i <= n; i++) {
if (n % i == 0) {
facts.push_back(i);
if (n / i != i) {
facts.push_back(n / i);
}
}
}
sort(facts.begin(), facts.end());
vector<set<int>> dp(facts.size());
dp[0].insert(0);
for (int i = 1; i < (int)facts.size(); i++) {
for (int j = 0; j < i; j++) {
if (facts[i] % facts[j] == 0) {
for (auto x: dp[j]) {
dp[i].insert(x + facts[i] / facts[j] - 1);
}
}
}
}
cout << dp.back().size() << '\n';
for (auto x: dp.back()) {
cout << x << " ";
}
}
# | 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... |