# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
584988 | hibiki | Toys (CEOI18_toy) | C++11 | 5059 ms | 6460 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 pb push_back
#define sz(x) (int)x.size()
int n;
set<int> sum[10005], ans;
int main()
{
sum[1].insert(0);
for(int i = 2; i < 10005; i++)
{
for(int j = 1; j * j <= i; j++)
{
if(i % j == 0)
{
int a = j;
int b = i / j;
for(auto _: sum[b])
{
sum[i].insert(a - 1 + _);
}
for(auto _: sum[a])
{
sum[i].insert(b - 1 + _);
}
}
}
}
// for(int i = 1; i < 10; i++)
// {
// printf("--%d--\n",i);
// for(auto val: sum[i])
// printf("%d ",val);
// printf("\n");
// }
scanf("%d",&n);
for(int j = 1; j * j <= n; j++)
{
if(n % j == 0)
{
int a = j;
int b = n / j;
for(auto _: sum[b])
{
ans.insert(a - 1 + _);
}
for(auto _: sum[a])
{
ans.insert(b - 1 + _);
}
}
}
printf("%d\n",sz(ans));
for(auto _: ans)
printf("%d ",_);
printf("\n");
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... |