Submission #536865

#TimeUsernameProblemLanguageResultExecution timeMemory
536865joelauToys (CEOI18_toy)C++14
100 / 100
1893 ms59832 KiB
#include <bits/stdc++.h> using namespace std; long long X; set<long long> ans; unordered_set<long long> s; void f(long long n, long long sum) { s.insert(n*1000000000+sum); ans.insert(sum+n-1); for (long long i = 2; i*i <= n; ++i) if (n % i == 0 && s.find(n/i*1000000000+sum+i-1) == s.end()) f(n/i,sum+i-1); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> X; f(X,0); cout << ans.size() << '\n'; for (auto x: ans) cout << x << ' '; 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...