# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
78897 | aminra | Toys (CEOI18_toy) | C++14 | 23 ms | 1660 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)3000 + 7;
const int infint = (int)1e9;
vector<int> dv, c[MAXN];
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++)
{
dv.push_back(i);
if(i * i != n)
dv.push_back(n / i);
}
sort(dv.begin(), dv.end());
for (int j = 1; j < dv.size(); j++)
for (int i = 0; i < j; i++)
if(dv[j] % dv[i] == 0)
c[j].push_back(i);
dp[0].insert(0);
for (int i = 1; i < dv.size(); i++)
for (auto j : c[i])
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... |