# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
585016 | hibiki | Toys (CEOI18_toy) | C++11 | 1990 ms | 86640 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<bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(x) (int)x.size()
int n;
map<int, set<int> > mp;
void find(int nw)
{
if(mp.count(nw))
return ;
mp[nw].insert(nw - 1);
for(int j = 2; j * j <= nw; j++)
{
if(nw % j == 0)
{
int a = j;
int b = nw / j;
find(a);
for(auto _: mp[a])
mp[nw].insert(b - 1 + _);
find(b);
for(auto _: mp[b])
mp[nw].insert(a - 1 + _);
}
}
// printf("%d\n",nw);
// for(auto _: mp[nw])
// printf("%d ",_);
// printf("\n");
}
int main()
{
mp[1].insert(0);
mp[2].insert(1);
scanf("%d",&n);
find(n);
printf("%d\n",sz(mp[n]));
for(auto _: mp[n])
printf("%d ",_);
printf("\n");
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... |