# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130006 | OptxPrime | Toys (CEOI18_toy) | C++11 | 5053 ms | 25016 KiB |
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 <iostream>
#include <cmath>
#include<vector>
#include <algorithm>
#include <utility>
#include<stack>
#include<queue>
#include<map>
#include <fstream>
#include<set>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
//map<int,bool> res;
map<int, set<int>> sums;
void num( int x )
{
sums[x].insert( x-1 );
for( int i=2;i<=sqrt(x);i++ ){
if( ( x%i )!= 0 ) continue;
if( sums[i].size() == 0 )num(i);
if( sums[ x/i ].size() == 0 ) num( (x/i) );
for( auto j:sums[i] ){
for( auto k:sums[x/i] ){
// cout << x << " " << i << " " <<x/i << " " << j << " "<< k
sums[x].insert( j+k );
}
}
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
num(n);
cout<<sums[n].size()<<endl;
for( auto i:sums[n] )
cout<<i<<" ";
cout<<endl;
return 0;
}
Compilation message (stderr)
# | 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... |