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;
const int N = 1e5;
set<int> ans[N];
int32_t main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<int> divs;
for (int i=1; i<=sqrt(n); ++i){
if (n%i == 0){
if (n/i != i) divs.emplace_back(n/i);
divs.emplace_back(i);
}
}
sort(divs.begin(),divs.end());
ans[0].emplace(0);
int nbDivs = divs.size();
for (int i=0; i<nbDivs; ++i){
for (int j=0; j<i; ++j){
if (divs[i]%divs[j]) continue;
for (int k:ans[j]) ans[i].emplace(k+divs[i]/divs[j]-1);
}
}
cout << ans[nbDivs-1].size() << '\n';
for (int i:ans[nbDivs-1]) 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... |