Submission #943484

#TimeUsernameProblemLanguageResultExecution timeMemory
943484maxFedorchukToys (CEOI18_toy)C++17
100 / 100
387 ms4820 KiB
#include <bits/stdc++.h> using namespace std; unordered_set < int > st; void cnt(int n,int sum,int mx) { st.insert(sum+n-1); for(int i=2;(i*i<=n && i<=mx);i++) { if((n%i)==0) { cnt(n/i,sum+i-1,i); } } } int main() { cin.tie(0); ios_base::sync_with_stdio(0); int n; cin>>n; cnt(n,0,n); vector < int > ans; for(auto u:st) { ans.push_back(u); } sort(ans.begin(),ans.end()); cout<<ans.size()<<"\n"; for(auto u:ans) { cout<<u<<" "; } cout<<"\n"; return 0; }
#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...