# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
960503 |
2024-04-10T14:34:31 Z |
vjudge1 |
Toys (CEOI18_toy) |
C++14 |
|
0 ms |
348 KB |
#include<bits/stdc++.h>
using namespace std;
int n;
vector<int> divs;
set<int> ans;
void backtrack(int cur, int lst, int sum){
if (cur==1){
ans.insert(sum);
return;
}
for (int i:divs){
if (i>lst) break;
if (cur%i) continue;
backtrack(cur/i, i, sum+i-1);
}
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i=1; i*i<=n; ++i) if (n%i==0){
if (i!=1) divs.push_back(i);
if (i*i!=n) divs.push_back(n/i);
}
sort(divs.begin(), divs.end());
for (int i:divs) backtrack(n/i, i, i-1);
cout << ans.size() << '\n';
vector<int> v(ans.begin(), ans.end());
for (int i=0; i<(int)v.size(); ++i){
if (i) cout << ' ';
cout << v[i];
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |