Submission #425084

#TimeUsernameProblemLanguageResultExecution timeMemory
425084Rouge_HugoToys (CEOI18_toy)C++14
59 / 100
5049 ms28232 KiB
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define pb push_back using namespace std; int n;const int N=100090; set<int>y; map<pair<int,int>,int>vis; vector<int>v,vv; void d(int sum,int p) { if(sum>n)return ; if(p>n)return ; if(vis[{sum,p}])return; vis[{sum,p}]=1; if(p==1) { y.insert(sum); return; } for(auto it:v) { if(p%it)continue; d(sum+it-1,p/it); } } int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n; for(int i=2;i<=n;i++) { if(n%i)continue; v.pb(i); } d(0,n); while(y.size()) { vv.pb(*y.begin()); y.erase(y.begin()); } cout<<vv.size()<<endl; for(auto it:vv)cout<<it<<" "; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...