Submission #70772

#TimeUsernameProblemLanguageResultExecution timeMemory
70772DiuvenToys (CEOI18_toy)C++14
100 / 100
1753 ms114864 KiB
#include <bits/stdc++.h> using namespace std; int n; vector<int> V, D[200010]; void init(){ for(int i=1; i*i<=n; i++) if(n%i==0){ V.push_back(i); if(i*i!=n) V.push_back(n/i); } sort(V.begin(), V.end()); } int main(){ ios::sync_with_stdio(0); cin.tie(0); cin>>n; init(); D[0].push_back(0); for(int i=1; i<(int)V.size(); i++){ vector<int> &W=D[i]; for(int j=0; j<i; j++) if(V[i]%V[j]==0) for(int x:D[j]) W.push_back(x+V[i]/V[j]-1); sort(W.begin(), W.end()); W.resize(unique(W.begin(), W.end())-W.begin()); } cout<<D[V.size()-1].size()<<'\n'; for(int x:D[V.size()-1]) cout<<x<<' '; 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...