Submission #582548

#TimeUsernameProblemLanguageResultExecution timeMemory
582548amunduzbaevToys (CEOI18_toy)C++17
100 / 100
1679 ms33384 KiB
#include "bits/stdc++.h" using namespace std; #define ar array typedef int64_t ll; #define int ll vector<int> res; void get(int n, int last, int sum){ if(n == 1){ res.push_back(sum); return; } for(int i=1;i * 1ll * i <= n;i++){ if(n % i == 0){ if(i >= last) get(n / i, i, sum + i - 1); if(n / i >= last) get(i, n / i, sum + (n / i) - 1); } } } signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n; cin>>n; get(n, 2, 0); sort(res.begin(), res.end()); res.erase(unique(res.begin(), res.end()), res.end()); cout<<(int)res.size()<<"\n"; for(auto x : res) cout<<x<<" "; cout<<"\n"; }
#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...