제출 #426339

#제출 시각아이디문제언어결과실행 시간메모리
426339lukadupliToys (CEOI18_toy)C++14
0 / 100
0 ms204 KiB
#include <bits/stdc++.h> using namespace std; int n; map <int, set <int>> memo; set <int> rek(int x){ if(x == 1) return {}; if(memo[x].size() != 0) return memo[x]; set <int> ret = {x - 1}; for(int i = 2; i <= sqrt(x); i++){ set <int> s = rek(x / i); for(auto e : s) ret.insert(e + i - 1); } memo[x] = ret; return ret; } int main() { cin >> n; set <int> sol = rek(n); if(sqrt(n) * sqrt(n) == n) sol.erase(sqrt(n) - 1); cout << sol.size() << '\n'; for(int e : sol) cout << e << ' '; 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...