# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
223106 | MKopchev | Toys (CEOI18_toy) | C++14 | 3907 ms | 90496 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;
map<int, set<int> > seen;
set<int> rec(int n)
{
if(seen.count(n))return seen[n];
set<int> ret={n-1};//use one type
for(int i=2;i*i<=n;i++)
if(n%i==0)
{
for(auto k:rec(n/i))
{
ret.insert(k+i-1);
}
}
seen[n]=ret;
return ret;
}
int main()
{
int n;
scanf("%i",&n);
set<int> output=rec(n);
printf("%i\n",output.size());
for(auto k:output)
{
printf("%i",k);
if(k!=n-1)printf(" ");
}
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... |