Submission #536861

#TimeUsernameProblemLanguageResultExecution timeMemory
536861joelauToys (CEOI18_toy)C++14
79 / 100
5067 ms72120 KiB
#include <bits/stdc++.h> using namespace std; long long X; set<long long> ans; set< pair<long long,long long> > s; void f(long long n, long long sum) { s.emplace(n,sum); ans.insert(sum+n-1); for (long long i = 2; i*i <= n; ++i) if (n % i == 0 && s.find(make_pair(n/i,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...