Submission #943487

#TimeUsernameProblemLanguageResultExecution timeMemory
943487maxFedorchukToys (CEOI18_toy)C++17
59 / 100
5049 ms1216 KiB
#include <bits/stdc++.h> using namespace std; unordered_set < int > st; void cnt(int n,int sum) { st.insert(sum+n-1); for(int i=2;i*i<=n;i++) { if((n%i)==0) { cnt(n/i,sum+i-1); cnt(i,sum+n/i-1); } } } int main() { cin.tie(0); ios_base::sync_with_stdio(0); int n; cin>>n; cnt(n,0); 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...