Submission #536920

#TimeUsernameProblemLanguageResultExecution timeMemory
536920hmm789Toys (CEOI18_toy)C++14
100 / 100
529 ms4292 KiB
#include <bits/stdc++.h> using namespace std; set<int> s; void factor(int x, int mn, int curans) { s.insert(curans); for(int i = mn; i*i <= x; i++) { if(x % i == 0) factor(x/i, i, curans-(x-1)+(i-1)+(x/i-1)); } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; factor(n, 2, n-1); cout << s.size() << '\n'; for(int i : s) cout << i << " "; }
#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...