Submission #649565

#TimeUsernameProblemLanguageResultExecution timeMemory
649565tvladm2009Toys (CEOI18_toy)C++14
100 / 100
2696 ms86772 KiB
#include <bits/stdc++.h> using ll = long long; std::map<int, std::set<int>> s; int main() { std::ios_base::sync_with_stdio(0); std::cin.tie(0); int n; std::cin >> n; std::vector<int> divs; for(int d = 1;d * d <= n; d++) { if(n % d == 0) { divs.push_back(d); if(d * d != n) divs.push_back(n / d); } } std::sort(divs.begin(), divs.end()); s[1].insert(0); for(auto x : divs) { if(x > 1) { for(int y : divs) { if(x % y == 0) { for(auto it : s[x / y]) s[x].insert(it + y - 1); } } } } std::cout << s[n].size() << "\n"; for(auto it : s[n]) std::cout << it << " "; 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...