# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
537340 |
2022-03-15T02:41:01 Z |
Hydroxic_Acid |
Toys (CEOI18_toy) |
C++17 |
|
214 ms |
262144 KB |
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
int n;
vector<int> v;
set<int> ans;
void dp(int N, int i, int summ){
if(N == 1){
ans.insert(summ); return;
}
for(int x = 0; x < (int)v.size(); x++){
if(v[x] >= i && N % v[x] == 0){
dp(N / v[x], v[x], summ + v[x] - 1);
}
}
}
signed main(){
cin >> n;
int f = 1;
while(f <= (int)sqrt(n) + 1){
if(n % f == 0){
if(f != 1) v.push_back(f);
if(n/f != f) v.push_back(n/f);
}
f++;
}
dp(n, 0, 0);
cout << (int)ans.size() << "\n";
for(set<int>::iterator it = ans.begin(); it != ans.end(); it++){
cout << (*it) << " ";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
214 ms |
262144 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
214 ms |
262144 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
214 ms |
262144 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
214 ms |
262144 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
214 ms |
262144 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |