#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
map<int,int> num;
signed main(){
int n;
cin>>n;
vector<int> d;
for (int i=1;i * i<=n;i++){
if (n % i == 0){
d.push_back(i);
d.push_back(n / i);
}
}
sort(begin(d),end(d));
set<int> S[d.size() + 100];
S[0].insert(0);
int k = d.size();
for (int i=0;i<k;i++)
num[d[i]] = i+1;
set<pair<int,int>> P;
P.insert({0,1});
for (int i=1;i<k;i++){
S[i].insert(d[i]-1);
for (auto [l,j] : P){
if (j * d[i] > n)
continue;
for (int m : S[i]){
P.insert({l + m,j * d[i]});
if (j * d[i] == n)
S[k-1].insert(l + m);
}
}
}
cout<<S[k-1].size()<<'\n';
for (int i : S[k-1])
printf("%d ",i);
printf("\n");
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
352 KB |
Output is correct |
24 |
Correct |
1 ms |
356 KB |
Output is correct |
25 |
Correct |
0 ms |
360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
352 KB |
Output is correct |
24 |
Correct |
1 ms |
356 KB |
Output is correct |
25 |
Correct |
0 ms |
360 KB |
Output is correct |
26 |
Correct |
5 ms |
1116 KB |
Output is correct |
27 |
Correct |
4 ms |
608 KB |
Output is correct |
28 |
Correct |
2 ms |
608 KB |
Output is correct |
29 |
Correct |
2 ms |
356 KB |
Output is correct |
30 |
Correct |
1 ms |
360 KB |
Output is correct |
31 |
Correct |
4 ms |
616 KB |
Output is correct |
32 |
Correct |
3 ms |
608 KB |
Output is correct |
33 |
Correct |
4 ms |
616 KB |
Output is correct |
34 |
Correct |
0 ms |
360 KB |
Output is correct |
35 |
Correct |
0 ms |
360 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
360 KB |
Output is correct |
38 |
Correct |
1 ms |
612 KB |
Output is correct |
39 |
Correct |
0 ms |
360 KB |
Output is correct |
40 |
Correct |
3 ms |
616 KB |
Output is correct |
41 |
Correct |
1 ms |
352 KB |
Output is correct |
42 |
Correct |
1 ms |
360 KB |
Output is correct |
43 |
Correct |
1 ms |
360 KB |
Output is correct |
44 |
Correct |
0 ms |
360 KB |
Output is correct |
45 |
Correct |
1 ms |
616 KB |
Output is correct |
46 |
Correct |
0 ms |
360 KB |
Output is correct |
47 |
Correct |
2 ms |
360 KB |
Output is correct |
48 |
Correct |
0 ms |
360 KB |
Output is correct |
49 |
Correct |
2 ms |
360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
352 KB |
Output is correct |
24 |
Correct |
1 ms |
356 KB |
Output is correct |
25 |
Correct |
0 ms |
360 KB |
Output is correct |
26 |
Correct |
5 ms |
1116 KB |
Output is correct |
27 |
Correct |
4 ms |
608 KB |
Output is correct |
28 |
Correct |
2 ms |
608 KB |
Output is correct |
29 |
Correct |
2 ms |
356 KB |
Output is correct |
30 |
Correct |
1 ms |
360 KB |
Output is correct |
31 |
Correct |
4 ms |
616 KB |
Output is correct |
32 |
Correct |
3 ms |
608 KB |
Output is correct |
33 |
Correct |
4 ms |
616 KB |
Output is correct |
34 |
Correct |
0 ms |
360 KB |
Output is correct |
35 |
Correct |
0 ms |
360 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
360 KB |
Output is correct |
38 |
Correct |
1 ms |
612 KB |
Output is correct |
39 |
Correct |
0 ms |
360 KB |
Output is correct |
40 |
Correct |
3 ms |
616 KB |
Output is correct |
41 |
Correct |
1 ms |
352 KB |
Output is correct |
42 |
Correct |
1 ms |
360 KB |
Output is correct |
43 |
Correct |
1 ms |
360 KB |
Output is correct |
44 |
Correct |
0 ms |
360 KB |
Output is correct |
45 |
Correct |
1 ms |
616 KB |
Output is correct |
46 |
Correct |
0 ms |
360 KB |
Output is correct |
47 |
Correct |
2 ms |
360 KB |
Output is correct |
48 |
Correct |
0 ms |
360 KB |
Output is correct |
49 |
Correct |
2 ms |
360 KB |
Output is correct |
50 |
Runtime error |
1173 ms |
262144 KB |
Execution killed with signal 9 |
51 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
352 KB |
Output is correct |
24 |
Correct |
1 ms |
356 KB |
Output is correct |
25 |
Correct |
0 ms |
360 KB |
Output is correct |
26 |
Correct |
5 ms |
1116 KB |
Output is correct |
27 |
Correct |
4 ms |
608 KB |
Output is correct |
28 |
Correct |
2 ms |
608 KB |
Output is correct |
29 |
Correct |
2 ms |
356 KB |
Output is correct |
30 |
Correct |
1 ms |
360 KB |
Output is correct |
31 |
Correct |
4 ms |
616 KB |
Output is correct |
32 |
Correct |
3 ms |
608 KB |
Output is correct |
33 |
Correct |
4 ms |
616 KB |
Output is correct |
34 |
Correct |
0 ms |
360 KB |
Output is correct |
35 |
Correct |
0 ms |
360 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
360 KB |
Output is correct |
38 |
Correct |
1 ms |
612 KB |
Output is correct |
39 |
Correct |
0 ms |
360 KB |
Output is correct |
40 |
Correct |
3 ms |
616 KB |
Output is correct |
41 |
Correct |
1 ms |
352 KB |
Output is correct |
42 |
Correct |
1 ms |
360 KB |
Output is correct |
43 |
Correct |
1 ms |
360 KB |
Output is correct |
44 |
Correct |
0 ms |
360 KB |
Output is correct |
45 |
Correct |
1 ms |
616 KB |
Output is correct |
46 |
Correct |
0 ms |
360 KB |
Output is correct |
47 |
Correct |
2 ms |
360 KB |
Output is correct |
48 |
Correct |
0 ms |
360 KB |
Output is correct |
49 |
Correct |
2 ms |
360 KB |
Output is correct |
50 |
Runtime error |
1173 ms |
262144 KB |
Execution killed with signal 9 |
51 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
352 KB |
Output is correct |
24 |
Correct |
1 ms |
356 KB |
Output is correct |
25 |
Correct |
0 ms |
360 KB |
Output is correct |
26 |
Correct |
5 ms |
1116 KB |
Output is correct |
27 |
Correct |
4 ms |
608 KB |
Output is correct |
28 |
Correct |
2 ms |
608 KB |
Output is correct |
29 |
Correct |
2 ms |
356 KB |
Output is correct |
30 |
Correct |
1 ms |
360 KB |
Output is correct |
31 |
Correct |
4 ms |
616 KB |
Output is correct |
32 |
Correct |
3 ms |
608 KB |
Output is correct |
33 |
Correct |
4 ms |
616 KB |
Output is correct |
34 |
Correct |
0 ms |
360 KB |
Output is correct |
35 |
Correct |
0 ms |
360 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
360 KB |
Output is correct |
38 |
Correct |
1 ms |
612 KB |
Output is correct |
39 |
Correct |
0 ms |
360 KB |
Output is correct |
40 |
Correct |
3 ms |
616 KB |
Output is correct |
41 |
Correct |
1 ms |
352 KB |
Output is correct |
42 |
Correct |
1 ms |
360 KB |
Output is correct |
43 |
Correct |
1 ms |
360 KB |
Output is correct |
44 |
Correct |
0 ms |
360 KB |
Output is correct |
45 |
Correct |
1 ms |
616 KB |
Output is correct |
46 |
Correct |
0 ms |
360 KB |
Output is correct |
47 |
Correct |
2 ms |
360 KB |
Output is correct |
48 |
Correct |
0 ms |
360 KB |
Output is correct |
49 |
Correct |
2 ms |
360 KB |
Output is correct |
50 |
Runtime error |
1173 ms |
262144 KB |
Execution killed with signal 9 |
51 |
Halted |
0 ms |
0 KB |
- |