Submission #81544

#TimeUsernameProblemLanguageResultExecution timeMemory
81544antimirageToys (CEOI18_toy)C++17
59 / 100
5026 ms17396 KiB
#include <bits/stdc++.h> #define mk make_pair #define pb push_back #define fr first #define sc second using namespace std; int n; vector <int> vec, ans; set <int> res; void dfs (int v, vector <int> &vec, int s = 0) { ans.pb(s + v - 1); for (auto to : vec) { if (v % to == 0 && v/ to >= to) dfs(v / to, vec, s + to - 1); } } int main() { cin >> n; for (int i = 2; i * i <= n; i++) { if (n % i != 0) continue; vec.pb(i); } dfs(n, vec); for (auto to : ans) res.insert(to); cout << res.size() << endl; for (auto to : res) printf("%d ", to); }
#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...