#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
signed main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n; cin >> n;
vector<int> p;
set<int> ans;
ans.insert(n-1);
for(int len = 2; len <= 33; len++){
function<void(int, int, int)> f=[&](int cur, int have, int sum){
if(have == len){
if(cur == n) ans.insert(sum);
return;
}
if(cur * (1<<(len - have)) > n) return;
for(int x = 2; cur * x <= n; x++){
f(cur*x, have + 1, sum + x - 1);
}
};
f(1, 0, 0);
}
cout << ans.size() << '\n';
for(auto x : ans) cout << x << ' ';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
352 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
456 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
352 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
460 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
352 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
600 KB |
Output is correct |
22 |
Correct |
1 ms |
500 KB |
Output is correct |
23 |
Correct |
0 ms |
600 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
352 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
456 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
352 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
460 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
352 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
600 KB |
Output is correct |
22 |
Correct |
1 ms |
500 KB |
Output is correct |
23 |
Correct |
0 ms |
600 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
52 ms |
448 KB |
Output is correct |
27 |
Correct |
26 ms |
348 KB |
Output is correct |
28 |
Correct |
8 ms |
344 KB |
Output is correct |
29 |
Correct |
4 ms |
348 KB |
Output is correct |
30 |
Correct |
3 ms |
348 KB |
Output is correct |
31 |
Correct |
68 ms |
348 KB |
Output is correct |
32 |
Correct |
48 ms |
688 KB |
Output is correct |
33 |
Correct |
43 ms |
348 KB |
Output is correct |
34 |
Correct |
88 ms |
344 KB |
Output is correct |
35 |
Correct |
78 ms |
344 KB |
Output is correct |
36 |
Correct |
60 ms |
436 KB |
Output is correct |
37 |
Correct |
55 ms |
452 KB |
Output is correct |
38 |
Correct |
82 ms |
432 KB |
Output is correct |
39 |
Correct |
81 ms |
432 KB |
Output is correct |
40 |
Correct |
68 ms |
348 KB |
Output is correct |
41 |
Correct |
83 ms |
348 KB |
Output is correct |
42 |
Correct |
85 ms |
436 KB |
Output is correct |
43 |
Correct |
67 ms |
432 KB |
Output is correct |
44 |
Correct |
93 ms |
432 KB |
Output is correct |
45 |
Correct |
84 ms |
440 KB |
Output is correct |
46 |
Correct |
80 ms |
432 KB |
Output is correct |
47 |
Correct |
83 ms |
348 KB |
Output is correct |
48 |
Correct |
79 ms |
348 KB |
Output is correct |
49 |
Correct |
80 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
352 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
456 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
352 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
460 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
352 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
600 KB |
Output is correct |
22 |
Correct |
1 ms |
500 KB |
Output is correct |
23 |
Correct |
0 ms |
600 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
52 ms |
448 KB |
Output is correct |
27 |
Correct |
26 ms |
348 KB |
Output is correct |
28 |
Correct |
8 ms |
344 KB |
Output is correct |
29 |
Correct |
4 ms |
348 KB |
Output is correct |
30 |
Correct |
3 ms |
348 KB |
Output is correct |
31 |
Correct |
68 ms |
348 KB |
Output is correct |
32 |
Correct |
48 ms |
688 KB |
Output is correct |
33 |
Correct |
43 ms |
348 KB |
Output is correct |
34 |
Correct |
88 ms |
344 KB |
Output is correct |
35 |
Correct |
78 ms |
344 KB |
Output is correct |
36 |
Correct |
60 ms |
436 KB |
Output is correct |
37 |
Correct |
55 ms |
452 KB |
Output is correct |
38 |
Correct |
82 ms |
432 KB |
Output is correct |
39 |
Correct |
81 ms |
432 KB |
Output is correct |
40 |
Correct |
68 ms |
348 KB |
Output is correct |
41 |
Correct |
83 ms |
348 KB |
Output is correct |
42 |
Correct |
85 ms |
436 KB |
Output is correct |
43 |
Correct |
67 ms |
432 KB |
Output is correct |
44 |
Correct |
93 ms |
432 KB |
Output is correct |
45 |
Correct |
84 ms |
440 KB |
Output is correct |
46 |
Correct |
80 ms |
432 KB |
Output is correct |
47 |
Correct |
83 ms |
348 KB |
Output is correct |
48 |
Correct |
79 ms |
348 KB |
Output is correct |
49 |
Correct |
80 ms |
348 KB |
Output is correct |
50 |
Correct |
3053 ms |
468 KB |
Output is correct |
51 |
Correct |
1514 ms |
348 KB |
Output is correct |
52 |
Correct |
1288 ms |
348 KB |
Output is correct |
53 |
Correct |
1083 ms |
456 KB |
Output is correct |
54 |
Correct |
463 ms |
600 KB |
Output is correct |
55 |
Correct |
3626 ms |
716 KB |
Output is correct |
56 |
Correct |
2954 ms |
468 KB |
Output is correct |
57 |
Correct |
2584 ms |
464 KB |
Output is correct |
58 |
Correct |
4103 ms |
432 KB |
Output is correct |
59 |
Correct |
3937 ms |
440 KB |
Output is correct |
60 |
Correct |
2079 ms |
592 KB |
Output is correct |
61 |
Correct |
3730 ms |
452 KB |
Output is correct |
62 |
Correct |
440 ms |
344 KB |
Output is correct |
63 |
Correct |
4100 ms |
448 KB |
Output is correct |
64 |
Correct |
4111 ms |
440 KB |
Output is correct |
65 |
Correct |
3447 ms |
456 KB |
Output is correct |
66 |
Correct |
4103 ms |
432 KB |
Output is correct |
67 |
Correct |
4139 ms |
432 KB |
Output is correct |
68 |
Correct |
4175 ms |
432 KB |
Output is correct |
69 |
Correct |
4179 ms |
440 KB |
Output is correct |
70 |
Correct |
3455 ms |
444 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
352 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
456 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
352 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
460 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
352 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
600 KB |
Output is correct |
22 |
Correct |
1 ms |
500 KB |
Output is correct |
23 |
Correct |
0 ms |
600 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
52 ms |
448 KB |
Output is correct |
27 |
Correct |
26 ms |
348 KB |
Output is correct |
28 |
Correct |
8 ms |
344 KB |
Output is correct |
29 |
Correct |
4 ms |
348 KB |
Output is correct |
30 |
Correct |
3 ms |
348 KB |
Output is correct |
31 |
Correct |
68 ms |
348 KB |
Output is correct |
32 |
Correct |
48 ms |
688 KB |
Output is correct |
33 |
Correct |
43 ms |
348 KB |
Output is correct |
34 |
Correct |
88 ms |
344 KB |
Output is correct |
35 |
Correct |
78 ms |
344 KB |
Output is correct |
36 |
Correct |
60 ms |
436 KB |
Output is correct |
37 |
Correct |
55 ms |
452 KB |
Output is correct |
38 |
Correct |
82 ms |
432 KB |
Output is correct |
39 |
Correct |
81 ms |
432 KB |
Output is correct |
40 |
Correct |
68 ms |
348 KB |
Output is correct |
41 |
Correct |
83 ms |
348 KB |
Output is correct |
42 |
Correct |
85 ms |
436 KB |
Output is correct |
43 |
Correct |
67 ms |
432 KB |
Output is correct |
44 |
Correct |
93 ms |
432 KB |
Output is correct |
45 |
Correct |
84 ms |
440 KB |
Output is correct |
46 |
Correct |
80 ms |
432 KB |
Output is correct |
47 |
Correct |
83 ms |
348 KB |
Output is correct |
48 |
Correct |
79 ms |
348 KB |
Output is correct |
49 |
Correct |
80 ms |
348 KB |
Output is correct |
50 |
Correct |
3053 ms |
468 KB |
Output is correct |
51 |
Correct |
1514 ms |
348 KB |
Output is correct |
52 |
Correct |
1288 ms |
348 KB |
Output is correct |
53 |
Correct |
1083 ms |
456 KB |
Output is correct |
54 |
Correct |
463 ms |
600 KB |
Output is correct |
55 |
Correct |
3626 ms |
716 KB |
Output is correct |
56 |
Correct |
2954 ms |
468 KB |
Output is correct |
57 |
Correct |
2584 ms |
464 KB |
Output is correct |
58 |
Correct |
4103 ms |
432 KB |
Output is correct |
59 |
Correct |
3937 ms |
440 KB |
Output is correct |
60 |
Correct |
2079 ms |
592 KB |
Output is correct |
61 |
Correct |
3730 ms |
452 KB |
Output is correct |
62 |
Correct |
440 ms |
344 KB |
Output is correct |
63 |
Correct |
4100 ms |
448 KB |
Output is correct |
64 |
Correct |
4111 ms |
440 KB |
Output is correct |
65 |
Correct |
3447 ms |
456 KB |
Output is correct |
66 |
Correct |
4103 ms |
432 KB |
Output is correct |
67 |
Correct |
4139 ms |
432 KB |
Output is correct |
68 |
Correct |
4175 ms |
432 KB |
Output is correct |
69 |
Correct |
4179 ms |
440 KB |
Output is correct |
70 |
Correct |
3455 ms |
444 KB |
Output is correct |
71 |
Execution timed out |
5080 ms |
684 KB |
Time limit exceeded |
72 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
352 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
456 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
352 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
460 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
352 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
600 KB |
Output is correct |
22 |
Correct |
1 ms |
500 KB |
Output is correct |
23 |
Correct |
0 ms |
600 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
52 ms |
448 KB |
Output is correct |
27 |
Correct |
26 ms |
348 KB |
Output is correct |
28 |
Correct |
8 ms |
344 KB |
Output is correct |
29 |
Correct |
4 ms |
348 KB |
Output is correct |
30 |
Correct |
3 ms |
348 KB |
Output is correct |
31 |
Correct |
68 ms |
348 KB |
Output is correct |
32 |
Correct |
48 ms |
688 KB |
Output is correct |
33 |
Correct |
43 ms |
348 KB |
Output is correct |
34 |
Correct |
88 ms |
344 KB |
Output is correct |
35 |
Correct |
78 ms |
344 KB |
Output is correct |
36 |
Correct |
60 ms |
436 KB |
Output is correct |
37 |
Correct |
55 ms |
452 KB |
Output is correct |
38 |
Correct |
82 ms |
432 KB |
Output is correct |
39 |
Correct |
81 ms |
432 KB |
Output is correct |
40 |
Correct |
68 ms |
348 KB |
Output is correct |
41 |
Correct |
83 ms |
348 KB |
Output is correct |
42 |
Correct |
85 ms |
436 KB |
Output is correct |
43 |
Correct |
67 ms |
432 KB |
Output is correct |
44 |
Correct |
93 ms |
432 KB |
Output is correct |
45 |
Correct |
84 ms |
440 KB |
Output is correct |
46 |
Correct |
80 ms |
432 KB |
Output is correct |
47 |
Correct |
83 ms |
348 KB |
Output is correct |
48 |
Correct |
79 ms |
348 KB |
Output is correct |
49 |
Correct |
80 ms |
348 KB |
Output is correct |
50 |
Correct |
3053 ms |
468 KB |
Output is correct |
51 |
Correct |
1514 ms |
348 KB |
Output is correct |
52 |
Correct |
1288 ms |
348 KB |
Output is correct |
53 |
Correct |
1083 ms |
456 KB |
Output is correct |
54 |
Correct |
463 ms |
600 KB |
Output is correct |
55 |
Correct |
3626 ms |
716 KB |
Output is correct |
56 |
Correct |
2954 ms |
468 KB |
Output is correct |
57 |
Correct |
2584 ms |
464 KB |
Output is correct |
58 |
Correct |
4103 ms |
432 KB |
Output is correct |
59 |
Correct |
3937 ms |
440 KB |
Output is correct |
60 |
Correct |
2079 ms |
592 KB |
Output is correct |
61 |
Correct |
3730 ms |
452 KB |
Output is correct |
62 |
Correct |
440 ms |
344 KB |
Output is correct |
63 |
Correct |
4100 ms |
448 KB |
Output is correct |
64 |
Correct |
4111 ms |
440 KB |
Output is correct |
65 |
Correct |
3447 ms |
456 KB |
Output is correct |
66 |
Correct |
4103 ms |
432 KB |
Output is correct |
67 |
Correct |
4139 ms |
432 KB |
Output is correct |
68 |
Correct |
4175 ms |
432 KB |
Output is correct |
69 |
Correct |
4179 ms |
440 KB |
Output is correct |
70 |
Correct |
3455 ms |
444 KB |
Output is correct |
71 |
Execution timed out |
5080 ms |
684 KB |
Time limit exceeded |
72 |
Halted |
0 ms |
0 KB |
- |