# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
536832 | jamezzz | Toys (CEOI18_toy) | C++17 | 5041 ms | 62688 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 sf scanf
#define pf printf
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define disc(x) sort(all(x));x.resize(unique(all(x))-x.begin());
typedef pair<int,int> ii;
int n;
set<ii> vis;
set<int> ans;
void dp(int x,int c){
if(vis.find({x,c})!=vis.end())return;
for(int i=2;i*i<=x;++i){
if(x%i==0)dp(x/i,c+i-1);
}
ans.insert(c+x-1);
vis.insert({x,c});
}
int main(){
sf("%d",&n);
dp(n,0);
pf("%d\n",sz(ans));
for(int i:ans)pf("%d ",i);
pf("\n");
}
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... |