This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
const int N = (int)2e5 + 5;
const int MAX = (int)1e8 + 5;
const ll mod = (int)1e9 + 7;
const ll inf = (int)(1e9) + 100;
int n;
vector<int> dv[N], ans;
bitset<MAX> b;
void rec(int c = 1, int sum = 0, int val = n) {
if (c == n) {
if (b[sum] == 0) ans.pb(sum);
b[sum] = 1;
return;
}
for (auto i : dv[val]) {
rec(c * i, sum + (i - 1), val / i);
}
}
void solve() {
cin >> n;
for (int i = 2; i <= n; i++) {
for (int j = i; j <= n; j += i) {
dv[j].pb(i);
}
}
rec();
cout << sz(ans) << "\n";
sort(all(ans));
for (int i : ans) cout << i << " ";
}
signed main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int T = 1;
//cin >> T;
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... |