Submission #464975

#TimeUsernameProblemLanguageResultExecution timeMemory
464975JovanBToys (CEOI18_toy)C++17
100 / 100
2032 ms4388 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; set <int> q; void dfs(int n, int sum, int last){ if(n == 1) q.insert(sum); for(int i=1; i*i<=n; i++){ if(n%i == 0){ if(i >= last) dfs(n/i, sum+i-1, i); if(i != n/i && n/i >= last) dfs(i, sum+n/i-1, n/i); } } } int main() { ios_base::sync_with_stdio(false); cout.precision(10); cout << fixed; int n; cin >> n; dfs(n, 0, 2); cout << q.size() << "\n"; for(auto c : q) cout << c << " "; 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...