Submission #463485

#TimeUsernameProblemLanguageResultExecution timeMemory
463485osmanallazovToys (CEOI18_toy)C++14
59 / 100
5007 ms16860 KiB
#include<bits/stdc++.h> using namespace std; int n; vector<int>v; vector<int>ans; set<int>se; void dfs(int a,vector<int>v,int s=0) { ans.push_back(s+a-1); for (int m:v) { if (a%m==0) dfs(a/m,v,s+m-1); } } int main() { cin>>n; for(int i=2;i*i<=n;i++) { if(n%i!=0) continue; v.push_back(i); if(i!=n/i) v.push_back(n/i); } dfs(n,v); for(auto i : ans) se.insert(i); cout<<se.size()<<endl; for(auto it : se) 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...