# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1007876 | 2024-06-25T16:39:50 Z | canonica1 | Toys (CEOI18_toy) | C++17 | 4966 ms | 87688 KB |
#include <algorithm> #include <iostream> #include <vector> #include <set> using namespace std; vector<int> ans; vector<int> factors; vector<vector<int>> g; vector<set<int>> M; void rec(int n, int answer) { if(M[n].count(answer)) return; M[n].insert(answer); if (factors[n] == 1) { ans.push_back(answer); return; } for(auto d : g[n]) { rec(d, answer + factors[n] / factors[d] - 1); } } int main() { int n; cin >> n; for (int i = 1; i * i <= n; i++) { if (n % i == 0) { factors.push_back(i); if (i * i != n) { factors.push_back(n / i); } } } sort(factors.begin(), factors.end()); g.resize(factors.size()); M.resize(factors.size()); for(int i = 0; i < factors.size(); i++){ for(int j = i + 1; j < factors.size(); j++){ if(factors[j] % factors[i] == 0){ g[j].push_back(i); } } } rec(factors.size() - 1, 0); sort(ans.begin(), ans.end()); cout << ans.size() << endl; for (auto x : ans) { cout << x << " "; } }
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 | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 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 | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 344 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 | 344 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 344 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 | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 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 | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 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 | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 344 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 | 344 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 344 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 | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 1 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 1 ms | 348 KB | Output is correct |
32 | Correct | 1 ms | 348 KB | Output is correct |
33 | Correct | 1 ms | 348 KB | Output is correct |
34 | Correct | 0 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 0 ms | 348 KB | Output is correct |
37 | Correct | 0 ms | 348 KB | Output is correct |
38 | Correct | 0 ms | 348 KB | Output is correct |
39 | Correct | 0 ms | 348 KB | Output is correct |
40 | Correct | 1 ms | 348 KB | Output is correct |
41 | Correct | 0 ms | 348 KB | Output is correct |
42 | Correct | 0 ms | 344 KB | Output is correct |
43 | Correct | 0 ms | 348 KB | Output is correct |
44 | Correct | 0 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 | 0 ms | 348 KB | Output is correct |
48 | Correct | 0 ms | 348 KB | Output is correct |
49 | 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 | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 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 | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 344 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 | 344 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 344 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 | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 1 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 1 ms | 348 KB | Output is correct |
32 | Correct | 1 ms | 348 KB | Output is correct |
33 | Correct | 1 ms | 348 KB | Output is correct |
34 | Correct | 0 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 0 ms | 348 KB | Output is correct |
37 | Correct | 0 ms | 348 KB | Output is correct |
38 | Correct | 0 ms | 348 KB | Output is correct |
39 | Correct | 0 ms | 348 KB | Output is correct |
40 | Correct | 1 ms | 348 KB | Output is correct |
41 | Correct | 0 ms | 348 KB | Output is correct |
42 | Correct | 0 ms | 344 KB | Output is correct |
43 | Correct | 0 ms | 348 KB | Output is correct |
44 | Correct | 0 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 | 0 ms | 348 KB | Output is correct |
48 | Correct | 0 ms | 348 KB | Output is correct |
49 | Correct | 0 ms | 348 KB | Output is correct |
50 | Correct | 2 ms | 604 KB | Output is correct |
51 | Correct | 2 ms | 660 KB | Output is correct |
52 | Correct | 2 ms | 604 KB | Output is correct |
53 | Correct | 2 ms | 600 KB | Output is correct |
54 | Correct | 1 ms | 348 KB | Output is correct |
55 | Correct | 3 ms | 604 KB | Output is correct |
56 | Correct | 3 ms | 600 KB | Output is correct |
57 | Correct | 3 ms | 604 KB | Output is correct |
58 | Correct | 0 ms | 348 KB | Output is correct |
59 | Correct | 0 ms | 348 KB | Output is correct |
60 | Correct | 1 ms | 348 KB | Output is correct |
61 | Correct | 1 ms | 604 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 | 1 ms | 604 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 | 348 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 | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 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 | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 344 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 | 344 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 344 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 | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 1 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 1 ms | 348 KB | Output is correct |
32 | Correct | 1 ms | 348 KB | Output is correct |
33 | Correct | 1 ms | 348 KB | Output is correct |
34 | Correct | 0 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 0 ms | 348 KB | Output is correct |
37 | Correct | 0 ms | 348 KB | Output is correct |
38 | Correct | 0 ms | 348 KB | Output is correct |
39 | Correct | 0 ms | 348 KB | Output is correct |
40 | Correct | 1 ms | 348 KB | Output is correct |
41 | Correct | 0 ms | 348 KB | Output is correct |
42 | Correct | 0 ms | 344 KB | Output is correct |
43 | Correct | 0 ms | 348 KB | Output is correct |
44 | Correct | 0 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 | 0 ms | 348 KB | Output is correct |
48 | Correct | 0 ms | 348 KB | Output is correct |
49 | Correct | 0 ms | 348 KB | Output is correct |
50 | Correct | 2 ms | 604 KB | Output is correct |
51 | Correct | 2 ms | 660 KB | Output is correct |
52 | Correct | 2 ms | 604 KB | Output is correct |
53 | Correct | 2 ms | 600 KB | Output is correct |
54 | Correct | 1 ms | 348 KB | Output is correct |
55 | Correct | 3 ms | 604 KB | Output is correct |
56 | Correct | 3 ms | 600 KB | Output is correct |
57 | Correct | 3 ms | 604 KB | Output is correct |
58 | Correct | 0 ms | 348 KB | Output is correct |
59 | Correct | 0 ms | 348 KB | Output is correct |
60 | Correct | 1 ms | 348 KB | Output is correct |
61 | Correct | 1 ms | 604 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 | 1 ms | 604 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 | 348 KB | Output is correct |
70 | Correct | 1 ms | 348 KB | Output is correct |
71 | Correct | 498 ms | 18932 KB | Output is correct |
72 | Correct | 305 ms | 14420 KB | Output is correct |
73 | Correct | 409 ms | 16844 KB | Output is correct |
74 | Correct | 220 ms | 11344 KB | Output is correct |
75 | Correct | 257 ms | 12120 KB | Output is correct |
76 | Correct | 779 ms | 25352 KB | Output is correct |
77 | Correct | 678 ms | 22264 KB | Output is correct |
78 | Correct | 573 ms | 21072 KB | Output is correct |
79 | Correct | 582 ms | 20304 KB | Output is correct |
80 | Correct | 1 ms | 344 KB | Output is correct |
81 | Correct | 1 ms | 348 KB | Output is correct |
82 | Correct | 2 ms | 604 KB | Output is correct |
83 | Correct | 51 ms | 3668 KB | Output is correct |
84 | Correct | 67 ms | 4432 KB | Output is correct |
85 | Correct | 13 ms | 1624 KB | Output is correct |
86 | Correct | 1 ms | 348 KB | Output is correct |
87 | Correct | 80 ms | 5172 KB | Output is correct |
88 | Correct | 1 ms | 344 KB | Output is correct |
89 | Correct | 0 ms | 348 KB | Output is correct |
90 | Correct | 0 ms | 348 KB | Output is correct |
91 | Correct | 17 ms | 2100 KB | Output is correct |
92 | Correct | 90 ms | 6640 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 | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 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 | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 344 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 | 344 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 344 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 | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 1 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 1 ms | 348 KB | Output is correct |
32 | Correct | 1 ms | 348 KB | Output is correct |
33 | Correct | 1 ms | 348 KB | Output is correct |
34 | Correct | 0 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 0 ms | 348 KB | Output is correct |
37 | Correct | 0 ms | 348 KB | Output is correct |
38 | Correct | 0 ms | 348 KB | Output is correct |
39 | Correct | 0 ms | 348 KB | Output is correct |
40 | Correct | 1 ms | 348 KB | Output is correct |
41 | Correct | 0 ms | 348 KB | Output is correct |
42 | Correct | 0 ms | 344 KB | Output is correct |
43 | Correct | 0 ms | 348 KB | Output is correct |
44 | Correct | 0 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 | 0 ms | 348 KB | Output is correct |
48 | Correct | 0 ms | 348 KB | Output is correct |
49 | Correct | 0 ms | 348 KB | Output is correct |
50 | Correct | 2 ms | 604 KB | Output is correct |
51 | Correct | 2 ms | 660 KB | Output is correct |
52 | Correct | 2 ms | 604 KB | Output is correct |
53 | Correct | 2 ms | 600 KB | Output is correct |
54 | Correct | 1 ms | 348 KB | Output is correct |
55 | Correct | 3 ms | 604 KB | Output is correct |
56 | Correct | 3 ms | 600 KB | Output is correct |
57 | Correct | 3 ms | 604 KB | Output is correct |
58 | Correct | 0 ms | 348 KB | Output is correct |
59 | Correct | 0 ms | 348 KB | Output is correct |
60 | Correct | 1 ms | 348 KB | Output is correct |
61 | Correct | 1 ms | 604 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 | 1 ms | 604 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 | 348 KB | Output is correct |
70 | Correct | 1 ms | 348 KB | Output is correct |
71 | Correct | 498 ms | 18932 KB | Output is correct |
72 | Correct | 305 ms | 14420 KB | Output is correct |
73 | Correct | 409 ms | 16844 KB | Output is correct |
74 | Correct | 220 ms | 11344 KB | Output is correct |
75 | Correct | 257 ms | 12120 KB | Output is correct |
76 | Correct | 779 ms | 25352 KB | Output is correct |
77 | Correct | 678 ms | 22264 KB | Output is correct |
78 | Correct | 573 ms | 21072 KB | Output is correct |
79 | Correct | 582 ms | 20304 KB | Output is correct |
80 | Correct | 1 ms | 344 KB | Output is correct |
81 | Correct | 1 ms | 348 KB | Output is correct |
82 | Correct | 2 ms | 604 KB | Output is correct |
83 | Correct | 51 ms | 3668 KB | Output is correct |
84 | Correct | 67 ms | 4432 KB | Output is correct |
85 | Correct | 13 ms | 1624 KB | Output is correct |
86 | Correct | 1 ms | 348 KB | Output is correct |
87 | Correct | 80 ms | 5172 KB | Output is correct |
88 | Correct | 1 ms | 344 KB | Output is correct |
89 | Correct | 0 ms | 348 KB | Output is correct |
90 | Correct | 0 ms | 348 KB | Output is correct |
91 | Correct | 17 ms | 2100 KB | Output is correct |
92 | Correct | 90 ms | 6640 KB | Output is correct |
93 | Correct | 3698 ms | 78268 KB | Output is correct |
94 | Correct | 1718 ms | 52952 KB | Output is correct |
95 | Correct | 2062 ms | 55588 KB | Output is correct |
96 | Correct | 1852 ms | 49608 KB | Output is correct |
97 | Correct | 1695 ms | 44916 KB | Output is correct |
98 | Correct | 4680 ms | 86184 KB | Output is correct |
99 | Correct | 4966 ms | 87688 KB | Output is correct |
100 | Correct | 4253 ms | 84280 KB | Output is correct |
101 | Correct | 3994 ms | 77892 KB | Output is correct |
102 | Correct | 3297 ms | 70108 KB | Output is correct |
103 | Correct | 2521 ms | 63184 KB | Output is correct |
104 | Correct | 0 ms | 348 KB | Output is correct |
105 | Correct | 0 ms | 348 KB | Output is correct |
106 | Correct | 4 ms | 952 KB | Output is correct |
107 | Correct | 175 ms | 9552 KB | Output is correct |
108 | Correct | 507 ms | 20560 KB | Output is correct |
109 | Correct | 29 ms | 3156 KB | Output is correct |
110 | Correct | 1 ms | 348 KB | Output is correct |
111 | Correct | 223 ms | 12208 KB | Output is correct |
112 | Correct | 1 ms | 348 KB | Output is correct |
113 | Correct | 0 ms | 348 KB | Output is correct |
114 | Correct | 4 ms | 860 KB | Output is correct |
115 | Correct | 0 ms | 348 KB | Output is correct |
116 | Correct | 9 ms | 1628 KB | Output is correct |
117 | Correct | 495 ms | 24996 KB | Output is correct |