# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
93395 | Kastanda | Toys (CEOI18_toy) | C++11 | 2891 ms | 91288 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>
#define pb push_back
using namespace std;
const int N = 100005;
int n;
vector < int > D;
set < int > M[N];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 1; i * i <= n; i++)
if (n % i == 0)
D.pb(i), D.pb(n / i);
sort(D.begin(), D.end());
D.resize(unique(D.begin(), D.end()) - D.begin());
M[0].insert(0);
for (int i = 1; i < D.size(); i++)
for (int j = 0; j < i; j++)
if (D[i] % D[j] == 0)
{
int d = D[i] / D[j] - 1;
for (int a : M[j])
M[i].insert(a + d);
}
int last = (int)D.size() - 1;
cout << (int)M[last].size() << "\n";
for (int a : M[last])
cout << a << " ";
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... |