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")
#pragma GCC target("avx2,sse2,sse,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC comment("/STACK:26666666")
#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace __gnu_pbds;
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
using vi = vector<int>;
const int mod = 1e9 + 7;
ll n;
vi divs, cans[1001000], canb[1001000];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
ll tn = n;
for (ll d = 1; d * d <= tn; d++) {
if (tn % d)
continue;
divs.pb(d);
if (d * d != n) {
divs.pb(n / d);
}
}
sort(all(divs));
cans[1].pb(0);
for (auto i : divs) {
vi &t = (i * i <= n ? cans[i] : canb[n / i]);
sort(all(t));
t.erase(unique(all(t)), t.end());
for (auto j : divs) {
if(j==1)continue;
if (i * j > n)
break;
if (n % (i * j))
continue;
ll _nxt = i * j;
vi &nxt = (_nxt * _nxt <= n ? cans[_nxt] : canb[n / _nxt]);
for (auto q : t) {
nxt.pb(q + j - 1);
}
}
}
vi &t = (n * n <= n ? cans[n] : canb[n / n]);
sort(all(t));
cout << t.size() << "\n";
for (auto i : t)
cout << i << " ";
}
Compilation message (stderr)
toy.cpp:4:0: warning: ignoring #pragma GCC comment [-Wunknown-pragmas]
#pragma GCC comment("/STACK:26666666")
# | 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... |