Submission #872913

#TimeUsernameProblemLanguageResultExecution timeMemory
872913Darren0724Toys (CEOI18_toy)C++17
100 / 100
1006 ms112848 KiB
#include <bits/stdc++.h> using namespace std; #define LCBorz \ ios_base::sync_with_stdio(false); \ cin.tie(0); //#define int long long #define all(x) x.begin(), x.end() #define x first #define y second const int N=100005; const int INF=1e9; vector<int> a; int sz; int32_t main() { LCBorz; int n;cin>>n; for(int i=1;i*i<=n;i++){ int j=n/i; if(n%i!=0){ continue; } a.push_back(i); if(j!=i){ a.push_back(j); } } sort(all(a)); sz=a.size(); vector<int> ans[sz]; ans[0].push_back(0); for(int i=0;i<sz;i++){ for(int j=0;j<i;j++){ if(a[i]%a[j]!=0){ continue; } int p=a[i]/a[j]; for(int j:ans[j]){ ans[i].push_back(j+p-1); } } sort(all(ans[i])); ans[i].resize(unique(all(ans[i]))-ans[i].begin()); } cout<<ans[sz-1].size()<<endl; for(int j:ans[sz-1]){ cout<<j<<' '; } cout<<endl; 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...