This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |