Submission #763464

#TimeUsernameProblemLanguageResultExecution timeMemory
763464SanguineChameleonToys (CEOI18_toy)C++17
100 / 100
2268 ms86472 KiB
#include <bits/stdc++.h> using namespace std; void just_do_it(); int main() { #ifdef KAMIRULEZ freopen("kamirulez.inp", "r", stdin); freopen("kamirulez.out", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); just_do_it(); return 0; } void just_do_it() { int n; cin >> n; vector<int> facts; for (int i = 1; i * i <= n; i++) { if (n % i == 0) { facts.push_back(i); if (n / i != i) { facts.push_back(n / i); } } } sort(facts.begin(), facts.end()); vector<set<int>> dp(facts.size()); dp[0].insert(0); for (int i = 1; i < (int)facts.size(); i++) { for (int j = 0; j < i; j++) { if (facts[i] % facts[j] == 0) { for (auto x: dp[j]) { dp[i].insert(x + facts[i] / facts[j] - 1); } } } } cout << dp.back().size() << '\n'; for (auto x: dp.back()) { cout << x << " "; } }
#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...