# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
536839 | jamezzz | Toys (CEOI18_toy) | C++17 | 1975 ms | 59920 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;
typedef long long ll;
int n;
unordered_set<ll> vis;
set<int> ans;
inline ll hh(int a,int b){
return (ll)a*1000000000+b;
}
void dp(int x,int c){
if(vis.find(hh(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(hh(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... |