Submission #463828

#TimeUsernameProblemLanguageResultExecution timeMemory
463828MamedovToys (CEOI18_toy)C++17
100 / 100
658 ms4324 KiB
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define ll long long #define ui unsigned int #define pii pair<int, int> #define piii pair<int, pii> #define pb push_back #define f first #define s second #define oo (1ll << 60) using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); set<int>s; void solve(int n, int d, int sum) { s.insert(sum + n - 1); for(int i = d; i * i <= n; ++i) { if(n % i == 0) { solve(n / i, i, sum + i - 1); } } } void solve() { int n; cin >> n; solve(n, 2, 0); cout << (int)s.size() << '\n'; for(int c : s) { cout << c << ' '; } cout << '\n'; } int main() { ios_base::sync_with_stdio(false); int t = 1; while(t--) { solve(); } 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...