Submission #572040

#TimeUsernameProblemLanguageResultExecution timeMemory
572040piOOEToys (CEOI18_toy)C++17
100 / 100
1743 ms86488 KiB
#include <bits/stdc++.h> using namespace std; #define sz(x) ((int)size(x)) #define all(x) begin(x), end(x) #define trace(x) cout << #x << ": " << (x) << endl; typedef long long ll; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); int rand(int l, int r) { return (int) ((ll) rnd() % (r - l + 1)) + l; } const int N = 10000; const ll infL = 3e18; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; if (n == 1) { cout << "1\n0"; return 0; } vector<int> div; for (int i = 1; i * i <= n; ++i) { if (n % i == 0) { div.push_back(i); div.push_back(n / i); } } sort(all(div)); div.resize(unique(all(div)) - begin(div)); int m = sz(div); vector<set<int>> st(m); for (int i = 1; i < m; ++i) { int x = div[i]; st[i].insert(x - 1); for (int j = i - 1; j > 0; --j) { int y = div[j]; if (x % y == 0) { int z = x / y; for (int u : st[j]) st[i].insert(z - 1 + u); } } } cout << sz(st[m - 1]) << '\n'; for (int x : st[m - 1]) cout << x << " "; 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...