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 targt("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
// #pragma GCC optimize("unroll-loops")
#include "bits/stdc++.h"
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/trie_policy.hpp>
// #include <ext/rope>
using namespace std;
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;
#define li long long
#define ld long double
#define ii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define eb emplace_back
#define em emplace
#define ob pop_back
#define om pop
#define of pop_front
#define fr front
#define bc back
#define fori(i, a, b) for(int i = (int) (a); i <= (int) (b); ++i)
#define ford(i, a, b) for(int i = (int) (a); i >= (int) (b); --i)
#define all(x) begin(x), end(x)
#define sz(x) ((int)(x).size())
#define bitc __builtin_popcountll
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand rng
#define endl '\n'
#define sp ' '
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void solve();
signed main() {
// freopen("output.out","w",stdout);
// fastio();
int tc = 1;
fori(test, 1, tc) {
solve();
}
return 0;
}
#define int long long
const ld pi = 4 * atan(1.0), eps = 1e-9;
const int maxn = 1e5 + 5;
int n;
vi fac;
vector<unordered_set<int> > List; //[4000];
void solve() {
cin >> n;
fori(i, 1, sqrt(n)) {
if(n % i == 0) {
if(n == i * i) fac.eb(i);
else {
fac.eb(i);
fac.eb(n/i);
}
}
}
List.resize(fac.size());
sort(all(fac));
List[0].em(0);
fori(i, 1, fac.size() - 1) {
fori(j, 0, i - 1) {
if(fac[i] % fac[j] == 0) {
int div = fac[i] / fac[j];
for(auto t: List[j]) {
List[i].em(t + div - 1);
}
}
}
}
vector<int> last;
for(auto t: List.back()) last.eb(t);
cout << last.size() << endl;
sort(all(last));
for(auto t: last) cout << t << sp;
}
# | 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... |