# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
78953 | aminra | Toys (CEOI18_toy) | C++14 | 3694 ms | 92104 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;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 7;
const int infint = (int)1e9;
vector<int> dv;
set<int> dp[MAXN];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n;
cin >> n;
for (int i = 1; i * i <= n; i++)
{
if(n % i)
continue;
dv.push_back(i);
if(i * i != n)
dv.push_back(n / i);
}
sort(dv.begin(), dv.end());
dp[0].insert(0);
for (int i = 1; i < dv.size(); i++)
for (int j = 0; j < i; j++)
if(dv[i] % dv[j] == 0)
for (auto u : dp[j])
dp[i].insert(u + dv[i] / dv[j] - 1);
cout << dp[dv.size() - 1].size() << "\n";
for (auto u : dp[dv.size() - 1])
cout << u << " ";
}
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... |