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;
map<int, set<int>> mp;
void getnr(int x){
if(mp.count(x))
return;
mp[x] = set<int>();
for(int d = 2; d*d <= x; d++){
if(x%d == 0){
getnr(x/d);
for(auto nr:mp[x/d])
mp[x].insert(nr + d - 1);
getnr(d);
for(auto nr:mp[d])
mp[x].insert(nr + x/d - 1);
}
}
mp[x].insert(x - 1);
}
int main()
{
//freopen(".in","r",stdin);
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int n;
cin>>n;
getnr(n);
cout<<mp[n].size()<<"\n";
for(auto x:mp[n])
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... |