Submission #497677

#TimeUsernameProblemLanguageResultExecution timeMemory
497677MilosMilutinovicToys (CEOI18_toy)C++14
100 / 100
501 ms4412 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(11); cerr << fixed << setprecision(6); int n; cin >> n; set<int> answer; function<void(int, int, int)> Dfs = [&](int sum, int rem, int lst) { answer.insert(sum + rem - 1); for (int i = lst; i * i <= rem; i++) { if (rem % i != 0) continue; Dfs(sum + i - 1, rem / i, i); } }; Dfs(0, n, 2); cout << answer.size() << "\n"; for (int c : answer) cout << c << " "; }
#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...