# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
278093 | 2020-08-21T10:09:13 Z | Retro3014 | Toys (CEOI18_toy) | C++17 | 3162 ms | 17008 KB |
#include <iostream> #include <algorithm> #include <vector> #include <stdio.h> using namespace std; #define INF 1000000001 typedef long long ll; int N; vector<int> d; vector<int> ans; int multi(int a, int b){ ll x = 1; while(b--){ x*=(ll)a; x = min(x, (ll)INF); } return min(x, (ll)INF); } int answer; int now; void dfs(int x, int y){ if(x==29){ if(now==1){ ans.push_back(answer); } return; } for(int i=y; i<d.size(); i++){ if(multi(d[i], 29-x)>now) return; if(now%d[i]!=0) continue; now/=d[i]; answer+=d[i]-1; dfs(x+1, i); answer-=d[i]-1; now*=d[i]; } } int main(){ scanf("%d", &N); for(int i=1; i*i<=N; i++){ if(N%i==0){ d.push_back(i); if(i*i!=N) d.push_back(N/i); } } sort(d.begin(), d.end()); now = N; dfs(1, 0); sort(ans.begin(), ans.end()); for(int i=ans.size()-1; i>0; i--){ if(ans[i]==ans[i-1]) ans[i] = INF; } sort(ans.begin(), ans.end()); while(!ans.empty() && ans.back()==INF) ans.pop_back(); printf("%d\n", ans.size()); for(int i=0; i<ans.size(); i++){ printf("%d ", ans[i]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
11 | Correct | 1 ms | 256 KB | Output is correct |
12 | Correct | 0 ms | 256 KB | Output is correct |
13 | Correct | 0 ms | 256 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 256 KB | Output is correct |
16 | Correct | 0 ms | 256 KB | Output is correct |
17 | Correct | 1 ms | 256 KB | Output is correct |
18 | Correct | 0 ms | 256 KB | Output is correct |
19 | Correct | 0 ms | 256 KB | Output is correct |
20 | Correct | 0 ms | 256 KB | Output is correct |
21 | Correct | 0 ms | 256 KB | Output is correct |
22 | Correct | 1 ms | 256 KB | Output is correct |
23 | Correct | 0 ms | 256 KB | Output is correct |
24 | Correct | 1 ms | 256 KB | Output is correct |
25 | Correct | 0 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
11 | Correct | 1 ms | 256 KB | Output is correct |
12 | Correct | 0 ms | 256 KB | Output is correct |
13 | Correct | 0 ms | 256 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 256 KB | Output is correct |
16 | Correct | 0 ms | 256 KB | Output is correct |
17 | Correct | 1 ms | 256 KB | Output is correct |
18 | Correct | 0 ms | 256 KB | Output is correct |
19 | Correct | 0 ms | 256 KB | Output is correct |
20 | Correct | 0 ms | 256 KB | Output is correct |
21 | Correct | 0 ms | 256 KB | Output is correct |
22 | Correct | 1 ms | 256 KB | Output is correct |
23 | Correct | 0 ms | 256 KB | Output is correct |
24 | Correct | 1 ms | 256 KB | Output is correct |
25 | Correct | 0 ms | 256 KB | Output is correct |
26 | Correct | 1 ms | 256 KB | Output is correct |
27 | Correct | 1 ms | 256 KB | Output is correct |
28 | Correct | 0 ms | 256 KB | Output is correct |
29 | Correct | 1 ms | 256 KB | Output is correct |
30 | Correct | 1 ms | 256 KB | Output is correct |
31 | Correct | 1 ms | 256 KB | Output is correct |
32 | Correct | 1 ms | 256 KB | Output is correct |
33 | Correct | 1 ms | 256 KB | Output is correct |
34 | Correct | 0 ms | 256 KB | Output is correct |
35 | Correct | 1 ms | 256 KB | Output is correct |
36 | Correct | 1 ms | 256 KB | Output is correct |
37 | Correct | 1 ms | 256 KB | Output is correct |
38 | Correct | 1 ms | 256 KB | Output is correct |
39 | Correct | 1 ms | 256 KB | Output is correct |
40 | Correct | 1 ms | 256 KB | Output is correct |
41 | Correct | 1 ms | 256 KB | Output is correct |
42 | Correct | 1 ms | 256 KB | Output is correct |
43 | Correct | 1 ms | 288 KB | Output is correct |
44 | Correct | 0 ms | 256 KB | Output is correct |
45 | Correct | 1 ms | 256 KB | Output is correct |
46 | Correct | 1 ms | 256 KB | Output is correct |
47 | Correct | 1 ms | 256 KB | Output is correct |
48 | Correct | 0 ms | 256 KB | Output is correct |
49 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
11 | Correct | 1 ms | 256 KB | Output is correct |
12 | Correct | 0 ms | 256 KB | Output is correct |
13 | Correct | 0 ms | 256 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 256 KB | Output is correct |
16 | Correct | 0 ms | 256 KB | Output is correct |
17 | Correct | 1 ms | 256 KB | Output is correct |
18 | Correct | 0 ms | 256 KB | Output is correct |
19 | Correct | 0 ms | 256 KB | Output is correct |
20 | Correct | 0 ms | 256 KB | Output is correct |
21 | Correct | 0 ms | 256 KB | Output is correct |
22 | Correct | 1 ms | 256 KB | Output is correct |
23 | Correct | 0 ms | 256 KB | Output is correct |
24 | Correct | 1 ms | 256 KB | Output is correct |
25 | Correct | 0 ms | 256 KB | Output is correct |
26 | Correct | 1 ms | 256 KB | Output is correct |
27 | Correct | 1 ms | 256 KB | Output is correct |
28 | Correct | 0 ms | 256 KB | Output is correct |
29 | Correct | 1 ms | 256 KB | Output is correct |
30 | Correct | 1 ms | 256 KB | Output is correct |
31 | Correct | 1 ms | 256 KB | Output is correct |
32 | Correct | 1 ms | 256 KB | Output is correct |
33 | Correct | 1 ms | 256 KB | Output is correct |
34 | Correct | 0 ms | 256 KB | Output is correct |
35 | Correct | 1 ms | 256 KB | Output is correct |
36 | Correct | 1 ms | 256 KB | Output is correct |
37 | Correct | 1 ms | 256 KB | Output is correct |
38 | Correct | 1 ms | 256 KB | Output is correct |
39 | Correct | 1 ms | 256 KB | Output is correct |
40 | Correct | 1 ms | 256 KB | Output is correct |
41 | Correct | 1 ms | 256 KB | Output is correct |
42 | Correct | 1 ms | 256 KB | Output is correct |
43 | Correct | 1 ms | 288 KB | Output is correct |
44 | Correct | 0 ms | 256 KB | Output is correct |
45 | Correct | 1 ms | 256 KB | Output is correct |
46 | Correct | 1 ms | 256 KB | Output is correct |
47 | Correct | 1 ms | 256 KB | Output is correct |
48 | Correct | 0 ms | 256 KB | Output is correct |
49 | Correct | 1 ms | 256 KB | Output is correct |
50 | Correct | 1 ms | 384 KB | Output is correct |
51 | Correct | 1 ms | 384 KB | Output is correct |
52 | Correct | 1 ms | 384 KB | Output is correct |
53 | Correct | 1 ms | 384 KB | Output is correct |
54 | Correct | 1 ms | 384 KB | Output is correct |
55 | Correct | 2 ms | 384 KB | Output is correct |
56 | Correct | 2 ms | 384 KB | Output is correct |
57 | Correct | 2 ms | 384 KB | Output is correct |
58 | Correct | 0 ms | 256 KB | Output is correct |
59 | Correct | 1 ms | 256 KB | Output is correct |
60 | Correct | 1 ms | 256 KB | Output is correct |
61 | Correct | 1 ms | 384 KB | Output is correct |
62 | Correct | 1 ms | 256 KB | Output is correct |
63 | Correct | 1 ms | 256 KB | Output is correct |
64 | Correct | 1 ms | 256 KB | Output is correct |
65 | Correct | 1 ms | 384 KB | Output is correct |
66 | Correct | 0 ms | 256 KB | Output is correct |
67 | Correct | 1 ms | 256 KB | Output is correct |
68 | Correct | 0 ms | 256 KB | Output is correct |
69 | Correct | 1 ms | 256 KB | Output is correct |
70 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
11 | Correct | 1 ms | 256 KB | Output is correct |
12 | Correct | 0 ms | 256 KB | Output is correct |
13 | Correct | 0 ms | 256 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 256 KB | Output is correct |
16 | Correct | 0 ms | 256 KB | Output is correct |
17 | Correct | 1 ms | 256 KB | Output is correct |
18 | Correct | 0 ms | 256 KB | Output is correct |
19 | Correct | 0 ms | 256 KB | Output is correct |
20 | Correct | 0 ms | 256 KB | Output is correct |
21 | Correct | 0 ms | 256 KB | Output is correct |
22 | Correct | 1 ms | 256 KB | Output is correct |
23 | Correct | 0 ms | 256 KB | Output is correct |
24 | Correct | 1 ms | 256 KB | Output is correct |
25 | Correct | 0 ms | 256 KB | Output is correct |
26 | Correct | 1 ms | 256 KB | Output is correct |
27 | Correct | 1 ms | 256 KB | Output is correct |
28 | Correct | 0 ms | 256 KB | Output is correct |
29 | Correct | 1 ms | 256 KB | Output is correct |
30 | Correct | 1 ms | 256 KB | Output is correct |
31 | Correct | 1 ms | 256 KB | Output is correct |
32 | Correct | 1 ms | 256 KB | Output is correct |
33 | Correct | 1 ms | 256 KB | Output is correct |
34 | Correct | 0 ms | 256 KB | Output is correct |
35 | Correct | 1 ms | 256 KB | Output is correct |
36 | Correct | 1 ms | 256 KB | Output is correct |
37 | Correct | 1 ms | 256 KB | Output is correct |
38 | Correct | 1 ms | 256 KB | Output is correct |
39 | Correct | 1 ms | 256 KB | Output is correct |
40 | Correct | 1 ms | 256 KB | Output is correct |
41 | Correct | 1 ms | 256 KB | Output is correct |
42 | Correct | 1 ms | 256 KB | Output is correct |
43 | Correct | 1 ms | 288 KB | Output is correct |
44 | Correct | 0 ms | 256 KB | Output is correct |
45 | Correct | 1 ms | 256 KB | Output is correct |
46 | Correct | 1 ms | 256 KB | Output is correct |
47 | Correct | 1 ms | 256 KB | Output is correct |
48 | Correct | 0 ms | 256 KB | Output is correct |
49 | Correct | 1 ms | 256 KB | Output is correct |
50 | Correct | 1 ms | 384 KB | Output is correct |
51 | Correct | 1 ms | 384 KB | Output is correct |
52 | Correct | 1 ms | 384 KB | Output is correct |
53 | Correct | 1 ms | 384 KB | Output is correct |
54 | Correct | 1 ms | 384 KB | Output is correct |
55 | Correct | 2 ms | 384 KB | Output is correct |
56 | Correct | 2 ms | 384 KB | Output is correct |
57 | Correct | 2 ms | 384 KB | Output is correct |
58 | Correct | 0 ms | 256 KB | Output is correct |
59 | Correct | 1 ms | 256 KB | Output is correct |
60 | Correct | 1 ms | 256 KB | Output is correct |
61 | Correct | 1 ms | 384 KB | Output is correct |
62 | Correct | 1 ms | 256 KB | Output is correct |
63 | Correct | 1 ms | 256 KB | Output is correct |
64 | Correct | 1 ms | 256 KB | Output is correct |
65 | Correct | 1 ms | 384 KB | Output is correct |
66 | Correct | 0 ms | 256 KB | Output is correct |
67 | Correct | 1 ms | 256 KB | Output is correct |
68 | Correct | 0 ms | 256 KB | Output is correct |
69 | Correct | 1 ms | 256 KB | Output is correct |
70 | Correct | 1 ms | 384 KB | Output is correct |
71 | Correct | 260 ms | 2572 KB | Output is correct |
72 | Correct | 153 ms | 1516 KB | Output is correct |
73 | Correct | 250 ms | 2516 KB | Output is correct |
74 | Correct | 109 ms | 1012 KB | Output is correct |
75 | Correct | 137 ms | 1520 KB | Output is correct |
76 | Correct | 487 ms | 4624 KB | Output is correct |
77 | Correct | 479 ms | 4572 KB | Output is correct |
78 | Correct | 341 ms | 2540 KB | Output is correct |
79 | Correct | 339 ms | 2540 KB | Output is correct |
80 | Correct | 1 ms | 256 KB | Output is correct |
81 | Correct | 1 ms | 256 KB | Output is correct |
82 | Correct | 1 ms | 384 KB | Output is correct |
83 | Correct | 20 ms | 768 KB | Output is correct |
84 | Correct | 25 ms | 768 KB | Output is correct |
85 | Correct | 4 ms | 384 KB | Output is correct |
86 | Correct | 1 ms | 256 KB | Output is correct |
87 | Correct | 24 ms | 768 KB | Output is correct |
88 | Correct | 1 ms | 252 KB | Output is correct |
89 | Correct | 1 ms | 384 KB | Output is correct |
90 | Correct | 1 ms | 256 KB | Output is correct |
91 | Correct | 8 ms | 384 KB | Output is correct |
92 | Correct | 40 ms | 768 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
11 | Correct | 1 ms | 256 KB | Output is correct |
12 | Correct | 0 ms | 256 KB | Output is correct |
13 | Correct | 0 ms | 256 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 256 KB | Output is correct |
16 | Correct | 0 ms | 256 KB | Output is correct |
17 | Correct | 1 ms | 256 KB | Output is correct |
18 | Correct | 0 ms | 256 KB | Output is correct |
19 | Correct | 0 ms | 256 KB | Output is correct |
20 | Correct | 0 ms | 256 KB | Output is correct |
21 | Correct | 0 ms | 256 KB | Output is correct |
22 | Correct | 1 ms | 256 KB | Output is correct |
23 | Correct | 0 ms | 256 KB | Output is correct |
24 | Correct | 1 ms | 256 KB | Output is correct |
25 | Correct | 0 ms | 256 KB | Output is correct |
26 | Correct | 1 ms | 256 KB | Output is correct |
27 | Correct | 1 ms | 256 KB | Output is correct |
28 | Correct | 0 ms | 256 KB | Output is correct |
29 | Correct | 1 ms | 256 KB | Output is correct |
30 | Correct | 1 ms | 256 KB | Output is correct |
31 | Correct | 1 ms | 256 KB | Output is correct |
32 | Correct | 1 ms | 256 KB | Output is correct |
33 | Correct | 1 ms | 256 KB | Output is correct |
34 | Correct | 0 ms | 256 KB | Output is correct |
35 | Correct | 1 ms | 256 KB | Output is correct |
36 | Correct | 1 ms | 256 KB | Output is correct |
37 | Correct | 1 ms | 256 KB | Output is correct |
38 | Correct | 1 ms | 256 KB | Output is correct |
39 | Correct | 1 ms | 256 KB | Output is correct |
40 | Correct | 1 ms | 256 KB | Output is correct |
41 | Correct | 1 ms | 256 KB | Output is correct |
42 | Correct | 1 ms | 256 KB | Output is correct |
43 | Correct | 1 ms | 288 KB | Output is correct |
44 | Correct | 0 ms | 256 KB | Output is correct |
45 | Correct | 1 ms | 256 KB | Output is correct |
46 | Correct | 1 ms | 256 KB | Output is correct |
47 | Correct | 1 ms | 256 KB | Output is correct |
48 | Correct | 0 ms | 256 KB | Output is correct |
49 | Correct | 1 ms | 256 KB | Output is correct |
50 | Correct | 1 ms | 384 KB | Output is correct |
51 | Correct | 1 ms | 384 KB | Output is correct |
52 | Correct | 1 ms | 384 KB | Output is correct |
53 | Correct | 1 ms | 384 KB | Output is correct |
54 | Correct | 1 ms | 384 KB | Output is correct |
55 | Correct | 2 ms | 384 KB | Output is correct |
56 | Correct | 2 ms | 384 KB | Output is correct |
57 | Correct | 2 ms | 384 KB | Output is correct |
58 | Correct | 0 ms | 256 KB | Output is correct |
59 | Correct | 1 ms | 256 KB | Output is correct |
60 | Correct | 1 ms | 256 KB | Output is correct |
61 | Correct | 1 ms | 384 KB | Output is correct |
62 | Correct | 1 ms | 256 KB | Output is correct |
63 | Correct | 1 ms | 256 KB | Output is correct |
64 | Correct | 1 ms | 256 KB | Output is correct |
65 | Correct | 1 ms | 384 KB | Output is correct |
66 | Correct | 0 ms | 256 KB | Output is correct |
67 | Correct | 1 ms | 256 KB | Output is correct |
68 | Correct | 0 ms | 256 KB | Output is correct |
69 | Correct | 1 ms | 256 KB | Output is correct |
70 | Correct | 1 ms | 384 KB | Output is correct |
71 | Correct | 260 ms | 2572 KB | Output is correct |
72 | Correct | 153 ms | 1516 KB | Output is correct |
73 | Correct | 250 ms | 2516 KB | Output is correct |
74 | Correct | 109 ms | 1012 KB | Output is correct |
75 | Correct | 137 ms | 1520 KB | Output is correct |
76 | Correct | 487 ms | 4624 KB | Output is correct |
77 | Correct | 479 ms | 4572 KB | Output is correct |
78 | Correct | 341 ms | 2540 KB | Output is correct |
79 | Correct | 339 ms | 2540 KB | Output is correct |
80 | Correct | 1 ms | 256 KB | Output is correct |
81 | Correct | 1 ms | 256 KB | Output is correct |
82 | Correct | 1 ms | 384 KB | Output is correct |
83 | Correct | 20 ms | 768 KB | Output is correct |
84 | Correct | 25 ms | 768 KB | Output is correct |
85 | Correct | 4 ms | 384 KB | Output is correct |
86 | Correct | 1 ms | 256 KB | Output is correct |
87 | Correct | 24 ms | 768 KB | Output is correct |
88 | Correct | 1 ms | 252 KB | Output is correct |
89 | Correct | 1 ms | 384 KB | Output is correct |
90 | Correct | 1 ms | 256 KB | Output is correct |
91 | Correct | 8 ms | 384 KB | Output is correct |
92 | Correct | 40 ms | 768 KB | Output is correct |
93 | Correct | 2465 ms | 9008 KB | Output is correct |
94 | Correct | 1032 ms | 4596 KB | Output is correct |
95 | Correct | 1264 ms | 8976 KB | Output is correct |
96 | Correct | 1179 ms | 4844 KB | Output is correct |
97 | Correct | 988 ms | 4828 KB | Output is correct |
98 | Correct | 2772 ms | 16972 KB | Output is correct |
99 | Correct | 3162 ms | 16928 KB | Output is correct |
100 | Correct | 2787 ms | 16948 KB | Output is correct |
101 | Correct | 2765 ms | 16836 KB | Output is correct |
102 | Correct | 2289 ms | 17008 KB | Output is correct |
103 | Correct | 1442 ms | 8668 KB | Output is correct |
104 | Correct | 1 ms | 256 KB | Output is correct |
105 | Correct | 1 ms | 256 KB | Output is correct |
106 | Incorrect | 2 ms | 384 KB | Output isn't correct |
107 | Halted | 0 ms | 0 KB | - |