# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
986011 | 2024-05-19T15:51:36 Z | raphaelp | Toys (CEOI18_toy) | C++14 | 5000 ms | 108332 KB |
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; if (N == 1) { cout << 1 << '\n' << 0; return 0; } vector<int> div; for (int i = 2; i <= sqrt(N); i++) { if (N % i == 0) { div.push_back(i); if (i != N / i) div.push_back(N / i); } } div.push_back(N); sort(div.begin(), div.end()); vector<vector<int>> pos(div.size()); for (int i = 0; i < div.size(); i++) pos[i].push_back(div[i] - 1); for (int i = 0; i < div.size(); i++) { for (int j = 0; div[j] <= sqrt(div[i]); j++) { int x = lower_bound(div.begin(), div.end(), div[i] / div[j]) - div.begin(); if (div[j] * div[x] != div[i]) continue; for (int k = 0; k < pos[j].size(); k++) { for (int l = 0; l < pos[x].size(); l++) { pos[i].push_back(pos[j][k] + pos[x][l]); } } } sort(pos[i].begin(), pos[i].end()); vector<int> temp = {pos[i][0]}; for (int j = 1; j < pos[i].size(); j++) if (pos[i][j] != pos[i][j - 1]) temp.push_back(pos[i][j]); swap(temp, pos[i]); } cout << pos[pos.size() - 1].size() << '\n'; for (int i = 0; i < pos[pos.size() - 1].size(); i++) { cout << pos[pos.size() - 1][i] << ' '; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 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 | 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 | 440 KB | Output is correct |
13 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 436 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 | 348 KB | Output is correct |
24 | Correct | 1 ms | 344 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 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 | 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 | 440 KB | Output is correct |
13 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 436 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 | 348 KB | Output is correct |
24 | Correct | 1 ms | 344 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 344 KB | Output is correct |
27 | Correct | 1 ms | 344 KB | Output is correct |
28 | Correct | 1 ms | 344 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 1 ms | 348 KB | Output is correct |
31 | Correct | 1 ms | 348 KB | Output is correct |
32 | Correct | 1 ms | 344 KB | Output is correct |
33 | Correct | 1 ms | 344 KB | Output is correct |
34 | Correct | 0 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 1 ms | 348 KB | Output is correct |
37 | Correct | 1 ms | 532 KB | Output is correct |
38 | Correct | 1 ms | 348 KB | Output is correct |
39 | Correct | 1 ms | 348 KB | Output is correct |
40 | Correct | 1 ms | 348 KB | Output is correct |
41 | Correct | 1 ms | 348 KB | Output is correct |
42 | Correct | 0 ms | 348 KB | Output is correct |
43 | Correct | 0 ms | 432 KB | Output is correct |
44 | Correct | 1 ms | 348 KB | Output is correct |
45 | Correct | 0 ms | 348 KB | Output is correct |
46 | Correct | 0 ms | 348 KB | Output is correct |
47 | Correct | 1 ms | 344 KB | Output is correct |
48 | Correct | 1 ms | 348 KB | Output is correct |
49 | Correct | 0 ms | 432 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 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 | 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 | 440 KB | Output is correct |
13 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 436 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 | 348 KB | Output is correct |
24 | Correct | 1 ms | 344 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 344 KB | Output is correct |
27 | Correct | 1 ms | 344 KB | Output is correct |
28 | Correct | 1 ms | 344 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 1 ms | 348 KB | Output is correct |
31 | Correct | 1 ms | 348 KB | Output is correct |
32 | Correct | 1 ms | 344 KB | Output is correct |
33 | Correct | 1 ms | 344 KB | Output is correct |
34 | Correct | 0 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 1 ms | 348 KB | Output is correct |
37 | Correct | 1 ms | 532 KB | Output is correct |
38 | Correct | 1 ms | 348 KB | Output is correct |
39 | Correct | 1 ms | 348 KB | Output is correct |
40 | Correct | 1 ms | 348 KB | Output is correct |
41 | Correct | 1 ms | 348 KB | Output is correct |
42 | Correct | 0 ms | 348 KB | Output is correct |
43 | Correct | 0 ms | 432 KB | Output is correct |
44 | Correct | 1 ms | 348 KB | Output is correct |
45 | Correct | 0 ms | 348 KB | Output is correct |
46 | Correct | 0 ms | 348 KB | Output is correct |
47 | Correct | 1 ms | 344 KB | Output is correct |
48 | Correct | 1 ms | 348 KB | Output is correct |
49 | Correct | 0 ms | 432 KB | Output is correct |
50 | Correct | 3 ms | 604 KB | Output is correct |
51 | Correct | 2 ms | 348 KB | Output is correct |
52 | Correct | 3 ms | 604 KB | Output is correct |
53 | Correct | 2 ms | 348 KB | Output is correct |
54 | Correct | 1 ms | 348 KB | Output is correct |
55 | Correct | 5 ms | 724 KB | Output is correct |
56 | Correct | 5 ms | 604 KB | Output is correct |
57 | Correct | 4 ms | 604 KB | Output is correct |
58 | Correct | 1 ms | 348 KB | Output is correct |
59 | Correct | 1 ms | 596 KB | Output is correct |
60 | Correct | 1 ms | 348 KB | Output is correct |
61 | Correct | 3 ms | 348 KB | Output is correct |
62 | Correct | 1 ms | 348 KB | Output is correct |
63 | Correct | 1 ms | 348 KB | Output is correct |
64 | Correct | 1 ms | 348 KB | Output is correct |
65 | Correct | 2 ms | 348 KB | Output is correct |
66 | Correct | 0 ms | 348 KB | Output is correct |
67 | Correct | 0 ms | 348 KB | Output is correct |
68 | Correct | 0 ms | 348 KB | Output is correct |
69 | Correct | 0 ms | 344 KB | Output is correct |
70 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 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 | 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 | 440 KB | Output is correct |
13 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 436 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 | 348 KB | Output is correct |
24 | Correct | 1 ms | 344 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 344 KB | Output is correct |
27 | Correct | 1 ms | 344 KB | Output is correct |
28 | Correct | 1 ms | 344 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 1 ms | 348 KB | Output is correct |
31 | Correct | 1 ms | 348 KB | Output is correct |
32 | Correct | 1 ms | 344 KB | Output is correct |
33 | Correct | 1 ms | 344 KB | Output is correct |
34 | Correct | 0 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 1 ms | 348 KB | Output is correct |
37 | Correct | 1 ms | 532 KB | Output is correct |
38 | Correct | 1 ms | 348 KB | Output is correct |
39 | Correct | 1 ms | 348 KB | Output is correct |
40 | Correct | 1 ms | 348 KB | Output is correct |
41 | Correct | 1 ms | 348 KB | Output is correct |
42 | Correct | 0 ms | 348 KB | Output is correct |
43 | Correct | 0 ms | 432 KB | Output is correct |
44 | Correct | 1 ms | 348 KB | Output is correct |
45 | Correct | 0 ms | 348 KB | Output is correct |
46 | Correct | 0 ms | 348 KB | Output is correct |
47 | Correct | 1 ms | 344 KB | Output is correct |
48 | Correct | 1 ms | 348 KB | Output is correct |
49 | Correct | 0 ms | 432 KB | Output is correct |
50 | Correct | 3 ms | 604 KB | Output is correct |
51 | Correct | 2 ms | 348 KB | Output is correct |
52 | Correct | 3 ms | 604 KB | Output is correct |
53 | Correct | 2 ms | 348 KB | Output is correct |
54 | Correct | 1 ms | 348 KB | Output is correct |
55 | Correct | 5 ms | 724 KB | Output is correct |
56 | Correct | 5 ms | 604 KB | Output is correct |
57 | Correct | 4 ms | 604 KB | Output is correct |
58 | Correct | 1 ms | 348 KB | Output is correct |
59 | Correct | 1 ms | 596 KB | Output is correct |
60 | Correct | 1 ms | 348 KB | Output is correct |
61 | Correct | 3 ms | 348 KB | Output is correct |
62 | Correct | 1 ms | 348 KB | Output is correct |
63 | Correct | 1 ms | 348 KB | Output is correct |
64 | Correct | 1 ms | 348 KB | Output is correct |
65 | Correct | 2 ms | 348 KB | Output is correct |
66 | Correct | 0 ms | 348 KB | Output is correct |
67 | Correct | 0 ms | 348 KB | Output is correct |
68 | Correct | 0 ms | 348 KB | Output is correct |
69 | Correct | 0 ms | 344 KB | Output is correct |
70 | Correct | 1 ms | 348 KB | Output is correct |
71 | Correct | 779 ms | 34412 KB | Output is correct |
72 | Correct | 445 ms | 27856 KB | Output is correct |
73 | Correct | 852 ms | 33868 KB | Output is correct |
74 | Correct | 330 ms | 17572 KB | Output is correct |
75 | Correct | 464 ms | 26912 KB | Output is correct |
76 | Correct | 1709 ms | 64348 KB | Output is correct |
77 | Correct | 1890 ms | 64688 KB | Output is correct |
78 | Correct | 1303 ms | 57428 KB | Output is correct |
79 | Correct | 1376 ms | 58448 KB | Output is correct |
80 | Correct | 0 ms | 348 KB | Output is correct |
81 | Correct | 0 ms | 348 KB | Output is correct |
82 | Correct | 9 ms | 908 KB | Output is correct |
83 | Correct | 173 ms | 7772 KB | Output is correct |
84 | Correct | 149 ms | 7816 KB | Output is correct |
85 | Correct | 30 ms | 2080 KB | Output is correct |
86 | Correct | 1 ms | 348 KB | Output is correct |
87 | Correct | 176 ms | 8036 KB | Output is correct |
88 | Correct | 0 ms | 348 KB | Output is correct |
89 | Correct | 1 ms | 348 KB | Output is correct |
90 | Correct | 1 ms | 348 KB | Output is correct |
91 | Correct | 22 ms | 1436 KB | Output is correct |
92 | Correct | 98 ms | 7328 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 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 | 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 | 440 KB | Output is correct |
13 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 436 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 | 348 KB | Output is correct |
24 | Correct | 1 ms | 344 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 344 KB | Output is correct |
27 | Correct | 1 ms | 344 KB | Output is correct |
28 | Correct | 1 ms | 344 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 1 ms | 348 KB | Output is correct |
31 | Correct | 1 ms | 348 KB | Output is correct |
32 | Correct | 1 ms | 344 KB | Output is correct |
33 | Correct | 1 ms | 344 KB | Output is correct |
34 | Correct | 0 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 1 ms | 348 KB | Output is correct |
37 | Correct | 1 ms | 532 KB | Output is correct |
38 | Correct | 1 ms | 348 KB | Output is correct |
39 | Correct | 1 ms | 348 KB | Output is correct |
40 | Correct | 1 ms | 348 KB | Output is correct |
41 | Correct | 1 ms | 348 KB | Output is correct |
42 | Correct | 0 ms | 348 KB | Output is correct |
43 | Correct | 0 ms | 432 KB | Output is correct |
44 | Correct | 1 ms | 348 KB | Output is correct |
45 | Correct | 0 ms | 348 KB | Output is correct |
46 | Correct | 0 ms | 348 KB | Output is correct |
47 | Correct | 1 ms | 344 KB | Output is correct |
48 | Correct | 1 ms | 348 KB | Output is correct |
49 | Correct | 0 ms | 432 KB | Output is correct |
50 | Correct | 3 ms | 604 KB | Output is correct |
51 | Correct | 2 ms | 348 KB | Output is correct |
52 | Correct | 3 ms | 604 KB | Output is correct |
53 | Correct | 2 ms | 348 KB | Output is correct |
54 | Correct | 1 ms | 348 KB | Output is correct |
55 | Correct | 5 ms | 724 KB | Output is correct |
56 | Correct | 5 ms | 604 KB | Output is correct |
57 | Correct | 4 ms | 604 KB | Output is correct |
58 | Correct | 1 ms | 348 KB | Output is correct |
59 | Correct | 1 ms | 596 KB | Output is correct |
60 | Correct | 1 ms | 348 KB | Output is correct |
61 | Correct | 3 ms | 348 KB | Output is correct |
62 | Correct | 1 ms | 348 KB | Output is correct |
63 | Correct | 1 ms | 348 KB | Output is correct |
64 | Correct | 1 ms | 348 KB | Output is correct |
65 | Correct | 2 ms | 348 KB | Output is correct |
66 | Correct | 0 ms | 348 KB | Output is correct |
67 | Correct | 0 ms | 348 KB | Output is correct |
68 | Correct | 0 ms | 348 KB | Output is correct |
69 | Correct | 0 ms | 344 KB | Output is correct |
70 | Correct | 1 ms | 348 KB | Output is correct |
71 | Correct | 779 ms | 34412 KB | Output is correct |
72 | Correct | 445 ms | 27856 KB | Output is correct |
73 | Correct | 852 ms | 33868 KB | Output is correct |
74 | Correct | 330 ms | 17572 KB | Output is correct |
75 | Correct | 464 ms | 26912 KB | Output is correct |
76 | Correct | 1709 ms | 64348 KB | Output is correct |
77 | Correct | 1890 ms | 64688 KB | Output is correct |
78 | Correct | 1303 ms | 57428 KB | Output is correct |
79 | Correct | 1376 ms | 58448 KB | Output is correct |
80 | Correct | 0 ms | 348 KB | Output is correct |
81 | Correct | 0 ms | 348 KB | Output is correct |
82 | Correct | 9 ms | 908 KB | Output is correct |
83 | Correct | 173 ms | 7772 KB | Output is correct |
84 | Correct | 149 ms | 7816 KB | Output is correct |
85 | Correct | 30 ms | 2080 KB | Output is correct |
86 | Correct | 1 ms | 348 KB | Output is correct |
87 | Correct | 176 ms | 8036 KB | Output is correct |
88 | Correct | 0 ms | 348 KB | Output is correct |
89 | Correct | 1 ms | 348 KB | Output is correct |
90 | Correct | 1 ms | 348 KB | Output is correct |
91 | Correct | 22 ms | 1436 KB | Output is correct |
92 | Correct | 98 ms | 7328 KB | Output is correct |
93 | Execution timed out | 5008 ms | 108332 KB | Time limit exceeded |
94 | Halted | 0 ms | 0 KB | - |