# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
123153 | davitmarg | Toys (CEOI18_toy) | C++17 | 5078 ms | 504 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.
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <stack>
#include <cassert>
#include <iterator>
#include <bitset>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
using namespace std;
int n;
vector<int> a;
set<int> s;
void dfs(int p,int sum,int d)
{
//cout<<sum<<" : "<<d<<endl;
if(p==a.size())
{
s.insert(sum+d-1);
return;
}
dfs(p+1,sum+d-1,a[p]);
dfs(p+1,sum,d*a[p]);
}
int main()
{
cin>>n;
for(int i=2;i*i<=n;i++)
{
if(n%i)
continue;
while(n%i==0)
{
a.PB(i);
n/=i;
}
}
if(n>1)
a.PB(n);
srand(564546);
sort(all(a));
for(int i=0;i<=10000;i++)
{
dfs(0,0,1);
random_shuffle(all(a));
}
cout<<s.size()<<endl;
for(auto it=s.begin();it!=s.end();++it)
printf("%d ",(*it));
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... |