# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
112413 |
2019-05-19T16:04:53 Z |
reda |
Toys (CEOI18_toy) |
C++14 |
|
2 ms |
384 KB |
#include <bits/stdc++.h>
using namespace std;
vector <int> ans;
void dfs (int a, vector <int> v ,int s)
{
ans.push_back(a-1);
for (int m:v)
if (a%m == 0)
dfs(a/m,v,m-1);
}
int main()
{
int n;
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
vector <int> v;
for (int i=2;i*i<=n;i++)
{
if(n%i!=0) continue;
v.push_back(i);
if(i!=n/i)
v.push_back(n/i);
}
dfs(n,v,0);
set <int> r;
for (auto i:ans)
r.insert(i);
cout << r.size() << endl;
for (auto it:r)
cout<<it<<' ';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |