# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
599447 | 1bin | Toys (CEOI18_toy) | C++14 | 2686 ms | 86568 KiB |
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 all(v) v.begin(), v.end()
typedef long long ll;
int n;
vector<int> v;
int main(void){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for(int i = 2; i * i <= n; i++){
if(n % i) continue;
v.emplace_back(i);
if(i * i != n) v.emplace_back(n / i);
}
v.emplace_back(n);
sort(all(v)); int sz = v.size();
vector<set<int>> dp(sz);
for(int i = 0; i < v.size(); i++){
dp[i].emplace(v[i] - 1);
for(int j = 0; j < i; j++){
if(v[i] % v[j]) continue;
for(int x : dp[j]) dp[i].emplace(v[i] / v[j] - 1 + x);
}
}
cout << dp[sz - 1].size() << '\n';
for(int x : dp[sz - 1]) cout << x << ' ';
return 0;
}
Compilation message (stderr)
# | 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... |