#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using oset = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
unordered_set<int> solve(int x) {
unordered_set<int> r;
r.insert(x - 1);
int y = 2;
while (y * y <= x) {
if (x % y == 0) {
int z = x / y;
unordered_set a = solve(y);
for (int b: a)
r.insert(b + z - 1);
a = solve(z);
for (int b: a)
r.insert(b + y - 1);
}
++y;
}
return r;
}
int main() {
fast;
int n;
cin >> n;
unordered_set<int> a = solve(n);
vi ans;
for (int x: a)
ans.push_back(x);
sort(all(ans));
cout << ans.size() << '\n';
for (int x: ans)
cout << x << ' ';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
460 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 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 |
0 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 |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
400 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
460 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 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 |
0 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 |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
400 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
7 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
348 KB |
Output is correct |
28 |
Correct |
2 ms |
452 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
20 ms |
348 KB |
Output is correct |
32 |
Correct |
10 ms |
348 KB |
Output is correct |
33 |
Correct |
8 ms |
544 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
344 KB |
Output is correct |
36 |
Correct |
2 ms |
344 KB |
Output is correct |
37 |
Correct |
8 ms |
460 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
1 ms |
456 KB |
Output is correct |
40 |
Correct |
5 ms |
468 KB |
Output is correct |
41 |
Correct |
0 ms |
604 KB |
Output is correct |
42 |
Correct |
0 ms |
348 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
47 |
Correct |
6 ms |
344 KB |
Output is correct |
48 |
Correct |
0 ms |
344 KB |
Output is correct |
49 |
Correct |
1 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
460 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 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 |
0 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 |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
400 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
7 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
348 KB |
Output is correct |
28 |
Correct |
2 ms |
452 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
20 ms |
348 KB |
Output is correct |
32 |
Correct |
10 ms |
348 KB |
Output is correct |
33 |
Correct |
8 ms |
544 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
344 KB |
Output is correct |
36 |
Correct |
2 ms |
344 KB |
Output is correct |
37 |
Correct |
8 ms |
460 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
1 ms |
456 KB |
Output is correct |
40 |
Correct |
5 ms |
468 KB |
Output is correct |
41 |
Correct |
0 ms |
604 KB |
Output is correct |
42 |
Correct |
0 ms |
348 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
47 |
Correct |
6 ms |
344 KB |
Output is correct |
48 |
Correct |
0 ms |
344 KB |
Output is correct |
49 |
Correct |
1 ms |
600 KB |
Output is correct |
50 |
Correct |
78 ms |
484 KB |
Output is correct |
51 |
Correct |
61 ms |
348 KB |
Output is correct |
52 |
Correct |
123 ms |
476 KB |
Output is correct |
53 |
Correct |
100 ms |
484 KB |
Output is correct |
54 |
Correct |
16 ms |
348 KB |
Output is correct |
55 |
Correct |
385 ms |
848 KB |
Output is correct |
56 |
Correct |
471 ms |
492 KB |
Output is correct |
57 |
Correct |
181 ms |
492 KB |
Output is correct |
58 |
Correct |
0 ms |
348 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
12 ms |
468 KB |
Output is correct |
61 |
Correct |
251 ms |
484 KB |
Output is correct |
62 |
Correct |
17 ms |
348 KB |
Output is correct |
63 |
Correct |
9 ms |
468 KB |
Output is correct |
64 |
Correct |
1 ms |
344 KB |
Output is correct |
65 |
Correct |
55 ms |
344 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
1 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
348 KB |
Output is correct |
69 |
Correct |
1 ms |
348 KB |
Output is correct |
70 |
Correct |
8 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
460 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 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 |
0 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 |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
400 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
7 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
348 KB |
Output is correct |
28 |
Correct |
2 ms |
452 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
20 ms |
348 KB |
Output is correct |
32 |
Correct |
10 ms |
348 KB |
Output is correct |
33 |
Correct |
8 ms |
544 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
344 KB |
Output is correct |
36 |
Correct |
2 ms |
344 KB |
Output is correct |
37 |
Correct |
8 ms |
460 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
1 ms |
456 KB |
Output is correct |
40 |
Correct |
5 ms |
468 KB |
Output is correct |
41 |
Correct |
0 ms |
604 KB |
Output is correct |
42 |
Correct |
0 ms |
348 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
47 |
Correct |
6 ms |
344 KB |
Output is correct |
48 |
Correct |
0 ms |
344 KB |
Output is correct |
49 |
Correct |
1 ms |
600 KB |
Output is correct |
50 |
Correct |
78 ms |
484 KB |
Output is correct |
51 |
Correct |
61 ms |
348 KB |
Output is correct |
52 |
Correct |
123 ms |
476 KB |
Output is correct |
53 |
Correct |
100 ms |
484 KB |
Output is correct |
54 |
Correct |
16 ms |
348 KB |
Output is correct |
55 |
Correct |
385 ms |
848 KB |
Output is correct |
56 |
Correct |
471 ms |
492 KB |
Output is correct |
57 |
Correct |
181 ms |
492 KB |
Output is correct |
58 |
Correct |
0 ms |
348 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
12 ms |
468 KB |
Output is correct |
61 |
Correct |
251 ms |
484 KB |
Output is correct |
62 |
Correct |
17 ms |
348 KB |
Output is correct |
63 |
Correct |
9 ms |
468 KB |
Output is correct |
64 |
Correct |
1 ms |
344 KB |
Output is correct |
65 |
Correct |
55 ms |
344 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
1 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
348 KB |
Output is correct |
69 |
Correct |
1 ms |
348 KB |
Output is correct |
70 |
Correct |
8 ms |
600 KB |
Output is correct |
71 |
Execution timed out |
5016 ms |
1044 KB |
Time limit exceeded |
72 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
460 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 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 |
0 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 |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
400 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
7 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
348 KB |
Output is correct |
28 |
Correct |
2 ms |
452 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
20 ms |
348 KB |
Output is correct |
32 |
Correct |
10 ms |
348 KB |
Output is correct |
33 |
Correct |
8 ms |
544 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
344 KB |
Output is correct |
36 |
Correct |
2 ms |
344 KB |
Output is correct |
37 |
Correct |
8 ms |
460 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
1 ms |
456 KB |
Output is correct |
40 |
Correct |
5 ms |
468 KB |
Output is correct |
41 |
Correct |
0 ms |
604 KB |
Output is correct |
42 |
Correct |
0 ms |
348 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
47 |
Correct |
6 ms |
344 KB |
Output is correct |
48 |
Correct |
0 ms |
344 KB |
Output is correct |
49 |
Correct |
1 ms |
600 KB |
Output is correct |
50 |
Correct |
78 ms |
484 KB |
Output is correct |
51 |
Correct |
61 ms |
348 KB |
Output is correct |
52 |
Correct |
123 ms |
476 KB |
Output is correct |
53 |
Correct |
100 ms |
484 KB |
Output is correct |
54 |
Correct |
16 ms |
348 KB |
Output is correct |
55 |
Correct |
385 ms |
848 KB |
Output is correct |
56 |
Correct |
471 ms |
492 KB |
Output is correct |
57 |
Correct |
181 ms |
492 KB |
Output is correct |
58 |
Correct |
0 ms |
348 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
12 ms |
468 KB |
Output is correct |
61 |
Correct |
251 ms |
484 KB |
Output is correct |
62 |
Correct |
17 ms |
348 KB |
Output is correct |
63 |
Correct |
9 ms |
468 KB |
Output is correct |
64 |
Correct |
1 ms |
344 KB |
Output is correct |
65 |
Correct |
55 ms |
344 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
1 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
348 KB |
Output is correct |
69 |
Correct |
1 ms |
348 KB |
Output is correct |
70 |
Correct |
8 ms |
600 KB |
Output is correct |
71 |
Execution timed out |
5016 ms |
1044 KB |
Time limit exceeded |
72 |
Halted |
0 ms |
0 KB |
- |