Submission #736368

#TimeUsernameProblemLanguageResultExecution timeMemory
736368studyToys (CEOI18_toy)C++17
100 / 100
2763 ms91336 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e5; set<int> ans[N]; int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<int> divs; for (int i=1; i<=sqrt(n); ++i){ if (n%i == 0){ if (n/i != i) divs.emplace_back(n/i); divs.emplace_back(i); } } sort(divs.begin(),divs.end()); ans[0].emplace(0); int nbDivs = divs.size(); for (int i=0; i<nbDivs; ++i){ for (int j=0; j<i; ++j){ if (divs[i]%divs[j]) continue; for (int k:ans[j]) ans[i].emplace(k+divs[i]/divs[j]-1); } } cout << ans[nbDivs-1].size() << '\n'; for (int i:ans[nbDivs-1]) cout << i << ' '; 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...