#include <bits/extc++.h>
using namespace std;
set<int> ans;
unordered_map<int, vector<int>> dvs;
set<tuple<int, int, int>> st;
void brute(int n, int sum, int prv) {
if (st.find({n, n+sum-1, prv}) != st.end()) return;
else {
st.insert({n, n+sum-1, prv});
ans.insert(n+sum-1);
}
for (int i: dvs[n]) {
if (i < prv) break;
brute(n/i, sum+i-1, i);
}
}
signed main() {
ios::sync_with_stdio(0); cin.tie(0);
int n; cin >> n; vector<int> dv;
for (int i = 1; i*i <= n; i++) {
if (n % i == 0) {
int a = i, b = n/i;
dv.push_back(a);
if (a != b) dv.push_back(b);
}
}
for (int j: dv) {
for (int i = 1; i*i <= j; i++) {
if (j % i == 0) {
int a = i, b = j/i;
if (a != 1 && a != j) dvs[j].push_back(a);
if (a != b && b != 1 && b != j) dvs[j].push_back(b);
}
}
sort(dvs[j].begin(), dvs[j].end(), greater<int>());
}
brute(n, 0, 0);
cout << ans.size() << '\n';
for (int i: ans) cout << i << ' ';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
0 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Correct |
0 ms |
204 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
0 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Correct |
0 ms |
204 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
0 ms |
204 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
1 ms |
332 KB |
Output is correct |
30 |
Correct |
1 ms |
332 KB |
Output is correct |
31 |
Correct |
2 ms |
460 KB |
Output is correct |
32 |
Correct |
1 ms |
332 KB |
Output is correct |
33 |
Correct |
1 ms |
332 KB |
Output is correct |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Correct |
0 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
332 KB |
Output is correct |
37 |
Correct |
1 ms |
332 KB |
Output is correct |
38 |
Correct |
1 ms |
332 KB |
Output is correct |
39 |
Correct |
0 ms |
204 KB |
Output is correct |
40 |
Correct |
1 ms |
332 KB |
Output is correct |
41 |
Correct |
0 ms |
204 KB |
Output is correct |
42 |
Correct |
0 ms |
204 KB |
Output is correct |
43 |
Correct |
0 ms |
204 KB |
Output is correct |
44 |
Correct |
0 ms |
204 KB |
Output is correct |
45 |
Correct |
1 ms |
332 KB |
Output is correct |
46 |
Correct |
0 ms |
204 KB |
Output is correct |
47 |
Correct |
1 ms |
332 KB |
Output is correct |
48 |
Correct |
0 ms |
204 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
0 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Correct |
0 ms |
204 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
0 ms |
204 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
1 ms |
332 KB |
Output is correct |
30 |
Correct |
1 ms |
332 KB |
Output is correct |
31 |
Correct |
2 ms |
460 KB |
Output is correct |
32 |
Correct |
1 ms |
332 KB |
Output is correct |
33 |
Correct |
1 ms |
332 KB |
Output is correct |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Correct |
0 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
332 KB |
Output is correct |
37 |
Correct |
1 ms |
332 KB |
Output is correct |
38 |
Correct |
1 ms |
332 KB |
Output is correct |
39 |
Correct |
0 ms |
204 KB |
Output is correct |
40 |
Correct |
1 ms |
332 KB |
Output is correct |
41 |
Correct |
0 ms |
204 KB |
Output is correct |
42 |
Correct |
0 ms |
204 KB |
Output is correct |
43 |
Correct |
0 ms |
204 KB |
Output is correct |
44 |
Correct |
0 ms |
204 KB |
Output is correct |
45 |
Correct |
1 ms |
332 KB |
Output is correct |
46 |
Correct |
0 ms |
204 KB |
Output is correct |
47 |
Correct |
1 ms |
332 KB |
Output is correct |
48 |
Correct |
0 ms |
204 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
50 |
Correct |
4 ms |
844 KB |
Output is correct |
51 |
Correct |
4 ms |
716 KB |
Output is correct |
52 |
Correct |
5 ms |
844 KB |
Output is correct |
53 |
Correct |
4 ms |
716 KB |
Output is correct |
54 |
Correct |
2 ms |
460 KB |
Output is correct |
55 |
Correct |
7 ms |
1100 KB |
Output is correct |
56 |
Correct |
7 ms |
1112 KB |
Output is correct |
57 |
Correct |
5 ms |
972 KB |
Output is correct |
58 |
Correct |
0 ms |
204 KB |
Output is correct |
59 |
Correct |
0 ms |
204 KB |
Output is correct |
60 |
Correct |
1 ms |
332 KB |
Output is correct |
61 |
Correct |
3 ms |
588 KB |
Output is correct |
62 |
Correct |
2 ms |
460 KB |
Output is correct |
63 |
Correct |
1 ms |
332 KB |
Output is correct |
64 |
Correct |
0 ms |
204 KB |
Output is correct |
65 |
Correct |
3 ms |
588 KB |
Output is correct |
66 |
Correct |
0 ms |
204 KB |
Output is correct |
67 |
Correct |
0 ms |
204 KB |
Output is correct |
68 |
Correct |
1 ms |
204 KB |
Output is correct |
69 |
Correct |
1 ms |
332 KB |
Output is correct |
70 |
Correct |
2 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
0 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Correct |
0 ms |
204 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
0 ms |
204 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
1 ms |
332 KB |
Output is correct |
30 |
Correct |
1 ms |
332 KB |
Output is correct |
31 |
Correct |
2 ms |
460 KB |
Output is correct |
32 |
Correct |
1 ms |
332 KB |
Output is correct |
33 |
Correct |
1 ms |
332 KB |
Output is correct |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Correct |
0 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
332 KB |
Output is correct |
37 |
Correct |
1 ms |
332 KB |
Output is correct |
38 |
Correct |
1 ms |
332 KB |
Output is correct |
39 |
Correct |
0 ms |
204 KB |
Output is correct |
40 |
Correct |
1 ms |
332 KB |
Output is correct |
41 |
Correct |
0 ms |
204 KB |
Output is correct |
42 |
Correct |
0 ms |
204 KB |
Output is correct |
43 |
Correct |
0 ms |
204 KB |
Output is correct |
44 |
Correct |
0 ms |
204 KB |
Output is correct |
45 |
Correct |
1 ms |
332 KB |
Output is correct |
46 |
Correct |
0 ms |
204 KB |
Output is correct |
47 |
Correct |
1 ms |
332 KB |
Output is correct |
48 |
Correct |
0 ms |
204 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
50 |
Correct |
4 ms |
844 KB |
Output is correct |
51 |
Correct |
4 ms |
716 KB |
Output is correct |
52 |
Correct |
5 ms |
844 KB |
Output is correct |
53 |
Correct |
4 ms |
716 KB |
Output is correct |
54 |
Correct |
2 ms |
460 KB |
Output is correct |
55 |
Correct |
7 ms |
1100 KB |
Output is correct |
56 |
Correct |
7 ms |
1112 KB |
Output is correct |
57 |
Correct |
5 ms |
972 KB |
Output is correct |
58 |
Correct |
0 ms |
204 KB |
Output is correct |
59 |
Correct |
0 ms |
204 KB |
Output is correct |
60 |
Correct |
1 ms |
332 KB |
Output is correct |
61 |
Correct |
3 ms |
588 KB |
Output is correct |
62 |
Correct |
2 ms |
460 KB |
Output is correct |
63 |
Correct |
1 ms |
332 KB |
Output is correct |
64 |
Correct |
0 ms |
204 KB |
Output is correct |
65 |
Correct |
3 ms |
588 KB |
Output is correct |
66 |
Correct |
0 ms |
204 KB |
Output is correct |
67 |
Correct |
0 ms |
204 KB |
Output is correct |
68 |
Correct |
1 ms |
204 KB |
Output is correct |
69 |
Correct |
1 ms |
332 KB |
Output is correct |
70 |
Correct |
2 ms |
460 KB |
Output is correct |
71 |
Correct |
1339 ms |
57920 KB |
Output is correct |
72 |
Correct |
784 ms |
39280 KB |
Output is correct |
73 |
Correct |
1471 ms |
58684 KB |
Output is correct |
74 |
Correct |
550 ms |
30404 KB |
Output is correct |
75 |
Correct |
771 ms |
37452 KB |
Output is correct |
76 |
Correct |
2868 ms |
96332 KB |
Output is correct |
77 |
Correct |
2816 ms |
89028 KB |
Output is correct |
78 |
Correct |
2081 ms |
74972 KB |
Output is correct |
79 |
Correct |
2090 ms |
74928 KB |
Output is correct |
80 |
Correct |
1 ms |
204 KB |
Output is correct |
81 |
Correct |
1 ms |
204 KB |
Output is correct |
82 |
Correct |
4 ms |
716 KB |
Output is correct |
83 |
Correct |
102 ms |
7832 KB |
Output is correct |
84 |
Correct |
152 ms |
10504 KB |
Output is correct |
85 |
Correct |
19 ms |
2204 KB |
Output is correct |
86 |
Correct |
1 ms |
332 KB |
Output is correct |
87 |
Correct |
133 ms |
10248 KB |
Output is correct |
88 |
Correct |
1 ms |
204 KB |
Output is correct |
89 |
Correct |
1 ms |
204 KB |
Output is correct |
90 |
Correct |
1 ms |
332 KB |
Output is correct |
91 |
Correct |
24 ms |
2836 KB |
Output is correct |
92 |
Correct |
169 ms |
12636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
0 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Correct |
0 ms |
204 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
0 ms |
204 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
1 ms |
332 KB |
Output is correct |
30 |
Correct |
1 ms |
332 KB |
Output is correct |
31 |
Correct |
2 ms |
460 KB |
Output is correct |
32 |
Correct |
1 ms |
332 KB |
Output is correct |
33 |
Correct |
1 ms |
332 KB |
Output is correct |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Correct |
0 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
332 KB |
Output is correct |
37 |
Correct |
1 ms |
332 KB |
Output is correct |
38 |
Correct |
1 ms |
332 KB |
Output is correct |
39 |
Correct |
0 ms |
204 KB |
Output is correct |
40 |
Correct |
1 ms |
332 KB |
Output is correct |
41 |
Correct |
0 ms |
204 KB |
Output is correct |
42 |
Correct |
0 ms |
204 KB |
Output is correct |
43 |
Correct |
0 ms |
204 KB |
Output is correct |
44 |
Correct |
0 ms |
204 KB |
Output is correct |
45 |
Correct |
1 ms |
332 KB |
Output is correct |
46 |
Correct |
0 ms |
204 KB |
Output is correct |
47 |
Correct |
1 ms |
332 KB |
Output is correct |
48 |
Correct |
0 ms |
204 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
50 |
Correct |
4 ms |
844 KB |
Output is correct |
51 |
Correct |
4 ms |
716 KB |
Output is correct |
52 |
Correct |
5 ms |
844 KB |
Output is correct |
53 |
Correct |
4 ms |
716 KB |
Output is correct |
54 |
Correct |
2 ms |
460 KB |
Output is correct |
55 |
Correct |
7 ms |
1100 KB |
Output is correct |
56 |
Correct |
7 ms |
1112 KB |
Output is correct |
57 |
Correct |
5 ms |
972 KB |
Output is correct |
58 |
Correct |
0 ms |
204 KB |
Output is correct |
59 |
Correct |
0 ms |
204 KB |
Output is correct |
60 |
Correct |
1 ms |
332 KB |
Output is correct |
61 |
Correct |
3 ms |
588 KB |
Output is correct |
62 |
Correct |
2 ms |
460 KB |
Output is correct |
63 |
Correct |
1 ms |
332 KB |
Output is correct |
64 |
Correct |
0 ms |
204 KB |
Output is correct |
65 |
Correct |
3 ms |
588 KB |
Output is correct |
66 |
Correct |
0 ms |
204 KB |
Output is correct |
67 |
Correct |
0 ms |
204 KB |
Output is correct |
68 |
Correct |
1 ms |
204 KB |
Output is correct |
69 |
Correct |
1 ms |
332 KB |
Output is correct |
70 |
Correct |
2 ms |
460 KB |
Output is correct |
71 |
Correct |
1339 ms |
57920 KB |
Output is correct |
72 |
Correct |
784 ms |
39280 KB |
Output is correct |
73 |
Correct |
1471 ms |
58684 KB |
Output is correct |
74 |
Correct |
550 ms |
30404 KB |
Output is correct |
75 |
Correct |
771 ms |
37452 KB |
Output is correct |
76 |
Correct |
2868 ms |
96332 KB |
Output is correct |
77 |
Correct |
2816 ms |
89028 KB |
Output is correct |
78 |
Correct |
2081 ms |
74972 KB |
Output is correct |
79 |
Correct |
2090 ms |
74928 KB |
Output is correct |
80 |
Correct |
1 ms |
204 KB |
Output is correct |
81 |
Correct |
1 ms |
204 KB |
Output is correct |
82 |
Correct |
4 ms |
716 KB |
Output is correct |
83 |
Correct |
102 ms |
7832 KB |
Output is correct |
84 |
Correct |
152 ms |
10504 KB |
Output is correct |
85 |
Correct |
19 ms |
2204 KB |
Output is correct |
86 |
Correct |
1 ms |
332 KB |
Output is correct |
87 |
Correct |
133 ms |
10248 KB |
Output is correct |
88 |
Correct |
1 ms |
204 KB |
Output is correct |
89 |
Correct |
1 ms |
204 KB |
Output is correct |
90 |
Correct |
1 ms |
332 KB |
Output is correct |
91 |
Correct |
24 ms |
2836 KB |
Output is correct |
92 |
Correct |
169 ms |
12636 KB |
Output is correct |
93 |
Execution timed out |
5063 ms |
181388 KB |
Time limit exceeded |
94 |
Halted |
0 ms |
0 KB |
- |