# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
538017 | 2022-03-16T03:10:28 Z | jamielim | Toys (CEOI18_toy) | C++14 | 1252 ms | 13836 KB |
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb emplace_back #define ALL(x) x.begin(),x.end() #define SZ(x) (int)x.size() typedef long long ll; typedef pair<int,int> ii; typedef pair<ii,ii> i4; const int MOD=1000000007; const int INF=1012345678; const ll LLINF=1012345678012345678LL; const double PI=3.1415926536; const double EPS=1e-14; int n; unordered_map<int, vector<int> > memo; vector<int> dp(int n){ if(memo.find(n)!=memo.end())return memo[n]; set<int> s; for(int i=2;i*i<=n;i++){ if(n%i!=0)continue; vector<int> y=dp(n/i); for(int j:y){ s.insert(j+i-1); } } s.insert(n-1); vector<int> ans; for(int i:s)ans.pb(i); memo[n]=ans; return ans; } int main(){ scanf("%d",&n); vector<int> ans=dp(n); sort(ALL(ans)); printf("%d\n",SZ(ans)); for(int i:ans){ printf("%d ",i); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 0 ms | 212 KB | Output is correct |
26 | Correct | 1 ms | 220 KB | Output is correct |
27 | Correct | 1 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 212 KB | Output is correct |
30 | Correct | 1 ms | 212 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 1 ms | 212 KB | Output is correct |
33 | Correct | 1 ms | 232 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 0 ms | 212 KB | Output is correct |
36 | Correct | 0 ms | 212 KB | Output is correct |
37 | Correct | 1 ms | 212 KB | Output is correct |
38 | Correct | 1 ms | 212 KB | Output is correct |
39 | Correct | 1 ms | 212 KB | Output is correct |
40 | Correct | 1 ms | 212 KB | Output is correct |
41 | Correct | 0 ms | 212 KB | Output is correct |
42 | Correct | 0 ms | 212 KB | Output is correct |
43 | Correct | 0 ms | 212 KB | Output is correct |
44 | Correct | 1 ms | 212 KB | Output is correct |
45 | Correct | 0 ms | 212 KB | Output is correct |
46 | Correct | 1 ms | 212 KB | Output is correct |
47 | Correct | 1 ms | 212 KB | Output is correct |
48 | Correct | 0 ms | 212 KB | Output is correct |
49 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 0 ms | 212 KB | Output is correct |
26 | Correct | 1 ms | 220 KB | Output is correct |
27 | Correct | 1 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 212 KB | Output is correct |
30 | Correct | 1 ms | 212 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 1 ms | 212 KB | Output is correct |
33 | Correct | 1 ms | 232 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 0 ms | 212 KB | Output is correct |
36 | Correct | 0 ms | 212 KB | Output is correct |
37 | Correct | 1 ms | 212 KB | Output is correct |
38 | Correct | 1 ms | 212 KB | Output is correct |
39 | Correct | 1 ms | 212 KB | Output is correct |
40 | Correct | 1 ms | 212 KB | Output is correct |
41 | Correct | 0 ms | 212 KB | Output is correct |
42 | Correct | 0 ms | 212 KB | Output is correct |
43 | Correct | 0 ms | 212 KB | Output is correct |
44 | Correct | 1 ms | 212 KB | Output is correct |
45 | Correct | 0 ms | 212 KB | Output is correct |
46 | Correct | 1 ms | 212 KB | Output is correct |
47 | Correct | 1 ms | 212 KB | Output is correct |
48 | Correct | 0 ms | 212 KB | Output is correct |
49 | Correct | 1 ms | 212 KB | Output is correct |
50 | Correct | 2 ms | 340 KB | Output is correct |
51 | Correct | 2 ms | 340 KB | Output is correct |
52 | Correct | 2 ms | 340 KB | Output is correct |
53 | Correct | 2 ms | 340 KB | Output is correct |
54 | Correct | 1 ms | 340 KB | Output is correct |
55 | Correct | 3 ms | 404 KB | Output is correct |
56 | Correct | 3 ms | 340 KB | Output is correct |
57 | Correct | 2 ms | 392 KB | Output is correct |
58 | Correct | 0 ms | 212 KB | Output is correct |
59 | Correct | 0 ms | 212 KB | Output is correct |
60 | Correct | 1 ms | 212 KB | Output is correct |
61 | Correct | 1 ms | 340 KB | Output is correct |
62 | Correct | 1 ms | 340 KB | Output is correct |
63 | Correct | 1 ms | 212 KB | Output is correct |
64 | Correct | 0 ms | 212 KB | Output is correct |
65 | Correct | 1 ms | 340 KB | Output is correct |
66 | Correct | 1 ms | 212 KB | Output is correct |
67 | Correct | 1 ms | 212 KB | Output is correct |
68 | Correct | 0 ms | 212 KB | Output is correct |
69 | Correct | 1 ms | 212 KB | Output is correct |
70 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 0 ms | 212 KB | Output is correct |
26 | Correct | 1 ms | 220 KB | Output is correct |
27 | Correct | 1 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 212 KB | Output is correct |
30 | Correct | 1 ms | 212 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 1 ms | 212 KB | Output is correct |
33 | Correct | 1 ms | 232 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 0 ms | 212 KB | Output is correct |
36 | Correct | 0 ms | 212 KB | Output is correct |
37 | Correct | 1 ms | 212 KB | Output is correct |
38 | Correct | 1 ms | 212 KB | Output is correct |
39 | Correct | 1 ms | 212 KB | Output is correct |
40 | Correct | 1 ms | 212 KB | Output is correct |
41 | Correct | 0 ms | 212 KB | Output is correct |
42 | Correct | 0 ms | 212 KB | Output is correct |
43 | Correct | 0 ms | 212 KB | Output is correct |
44 | Correct | 1 ms | 212 KB | Output is correct |
45 | Correct | 0 ms | 212 KB | Output is correct |
46 | Correct | 1 ms | 212 KB | Output is correct |
47 | Correct | 1 ms | 212 KB | Output is correct |
48 | Correct | 0 ms | 212 KB | Output is correct |
49 | Correct | 1 ms | 212 KB | Output is correct |
50 | Correct | 2 ms | 340 KB | Output is correct |
51 | Correct | 2 ms | 340 KB | Output is correct |
52 | Correct | 2 ms | 340 KB | Output is correct |
53 | Correct | 2 ms | 340 KB | Output is correct |
54 | Correct | 1 ms | 340 KB | Output is correct |
55 | Correct | 3 ms | 404 KB | Output is correct |
56 | Correct | 3 ms | 340 KB | Output is correct |
57 | Correct | 2 ms | 392 KB | Output is correct |
58 | Correct | 0 ms | 212 KB | Output is correct |
59 | Correct | 0 ms | 212 KB | Output is correct |
60 | Correct | 1 ms | 212 KB | Output is correct |
61 | Correct | 1 ms | 340 KB | Output is correct |
62 | Correct | 1 ms | 340 KB | Output is correct |
63 | Correct | 1 ms | 212 KB | Output is correct |
64 | Correct | 0 ms | 212 KB | Output is correct |
65 | Correct | 1 ms | 340 KB | Output is correct |
66 | Correct | 1 ms | 212 KB | Output is correct |
67 | Correct | 1 ms | 212 KB | Output is correct |
68 | Correct | 0 ms | 212 KB | Output is correct |
69 | Correct | 1 ms | 212 KB | Output is correct |
70 | Correct | 1 ms | 212 KB | Output is correct |
71 | Correct | 199 ms | 3476 KB | Output is correct |
72 | Correct | 128 ms | 2804 KB | Output is correct |
73 | Correct | 163 ms | 3024 KB | Output is correct |
74 | Correct | 113 ms | 2268 KB | Output is correct |
75 | Correct | 110 ms | 2380 KB | Output is correct |
76 | Correct | 272 ms | 4484 KB | Output is correct |
77 | Correct | 256 ms | 3980 KB | Output is correct |
78 | Correct | 212 ms | 3756 KB | Output is correct |
79 | Correct | 237 ms | 3636 KB | Output is correct |
80 | Correct | 1 ms | 212 KB | Output is correct |
81 | Correct | 0 ms | 212 KB | Output is correct |
82 | Correct | 2 ms | 392 KB | Output is correct |
83 | Correct | 25 ms | 1224 KB | Output is correct |
84 | Correct | 35 ms | 1276 KB | Output is correct |
85 | Correct | 8 ms | 724 KB | Output is correct |
86 | Correct | 1 ms | 212 KB | Output is correct |
87 | Correct | 39 ms | 1440 KB | Output is correct |
88 | Correct | 1 ms | 212 KB | Output is correct |
89 | Correct | 0 ms | 212 KB | Output is correct |
90 | Correct | 1 ms | 212 KB | Output is correct |
91 | Correct | 12 ms | 852 KB | Output is correct |
92 | Correct | 49 ms | 1612 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 0 ms | 212 KB | Output is correct |
26 | Correct | 1 ms | 220 KB | Output is correct |
27 | Correct | 1 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 212 KB | Output is correct |
30 | Correct | 1 ms | 212 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 1 ms | 212 KB | Output is correct |
33 | Correct | 1 ms | 232 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 0 ms | 212 KB | Output is correct |
36 | Correct | 0 ms | 212 KB | Output is correct |
37 | Correct | 1 ms | 212 KB | Output is correct |
38 | Correct | 1 ms | 212 KB | Output is correct |
39 | Correct | 1 ms | 212 KB | Output is correct |
40 | Correct | 1 ms | 212 KB | Output is correct |
41 | Correct | 0 ms | 212 KB | Output is correct |
42 | Correct | 0 ms | 212 KB | Output is correct |
43 | Correct | 0 ms | 212 KB | Output is correct |
44 | Correct | 1 ms | 212 KB | Output is correct |
45 | Correct | 0 ms | 212 KB | Output is correct |
46 | Correct | 1 ms | 212 KB | Output is correct |
47 | Correct | 1 ms | 212 KB | Output is correct |
48 | Correct | 0 ms | 212 KB | Output is correct |
49 | Correct | 1 ms | 212 KB | Output is correct |
50 | Correct | 2 ms | 340 KB | Output is correct |
51 | Correct | 2 ms | 340 KB | Output is correct |
52 | Correct | 2 ms | 340 KB | Output is correct |
53 | Correct | 2 ms | 340 KB | Output is correct |
54 | Correct | 1 ms | 340 KB | Output is correct |
55 | Correct | 3 ms | 404 KB | Output is correct |
56 | Correct | 3 ms | 340 KB | Output is correct |
57 | Correct | 2 ms | 392 KB | Output is correct |
58 | Correct | 0 ms | 212 KB | Output is correct |
59 | Correct | 0 ms | 212 KB | Output is correct |
60 | Correct | 1 ms | 212 KB | Output is correct |
61 | Correct | 1 ms | 340 KB | Output is correct |
62 | Correct | 1 ms | 340 KB | Output is correct |
63 | Correct | 1 ms | 212 KB | Output is correct |
64 | Correct | 0 ms | 212 KB | Output is correct |
65 | Correct | 1 ms | 340 KB | Output is correct |
66 | Correct | 1 ms | 212 KB | Output is correct |
67 | Correct | 1 ms | 212 KB | Output is correct |
68 | Correct | 0 ms | 212 KB | Output is correct |
69 | Correct | 1 ms | 212 KB | Output is correct |
70 | Correct | 1 ms | 212 KB | Output is correct |
71 | Correct | 199 ms | 3476 KB | Output is correct |
72 | Correct | 128 ms | 2804 KB | Output is correct |
73 | Correct | 163 ms | 3024 KB | Output is correct |
74 | Correct | 113 ms | 2268 KB | Output is correct |
75 | Correct | 110 ms | 2380 KB | Output is correct |
76 | Correct | 272 ms | 4484 KB | Output is correct |
77 | Correct | 256 ms | 3980 KB | Output is correct |
78 | Correct | 212 ms | 3756 KB | Output is correct |
79 | Correct | 237 ms | 3636 KB | Output is correct |
80 | Correct | 1 ms | 212 KB | Output is correct |
81 | Correct | 0 ms | 212 KB | Output is correct |
82 | Correct | 2 ms | 392 KB | Output is correct |
83 | Correct | 25 ms | 1224 KB | Output is correct |
84 | Correct | 35 ms | 1276 KB | Output is correct |
85 | Correct | 8 ms | 724 KB | Output is correct |
86 | Correct | 1 ms | 212 KB | Output is correct |
87 | Correct | 39 ms | 1440 KB | Output is correct |
88 | Correct | 1 ms | 212 KB | Output is correct |
89 | Correct | 0 ms | 212 KB | Output is correct |
90 | Correct | 1 ms | 212 KB | Output is correct |
91 | Correct | 12 ms | 852 KB | Output is correct |
92 | Correct | 49 ms | 1612 KB | Output is correct |
93 | Correct | 1051 ms | 12132 KB | Output is correct |
94 | Correct | 623 ms | 8868 KB | Output is correct |
95 | Correct | 668 ms | 8952 KB | Output is correct |
96 | Correct | 592 ms | 8148 KB | Output is correct |
97 | Correct | 528 ms | 7344 KB | Output is correct |
98 | Correct | 1176 ms | 13100 KB | Output is correct |
99 | Correct | 1252 ms | 13836 KB | Output is correct |
100 | Correct | 1156 ms | 12768 KB | Output is correct |
101 | Correct | 1086 ms | 12264 KB | Output is correct |
102 | Correct | 946 ms | 11136 KB | Output is correct |
103 | Correct | 780 ms | 10104 KB | Output is correct |
104 | Correct | 1 ms | 212 KB | Output is correct |
105 | Correct | 1 ms | 212 KB | Output is correct |
106 | Correct | 4 ms | 468 KB | Output is correct |
107 | Correct | 81 ms | 2788 KB | Output is correct |
108 | Correct | 210 ms | 4680 KB | Output is correct |
109 | Correct | 22 ms | 1236 KB | Output is correct |
110 | Correct | 1 ms | 212 KB | Output is correct |
111 | Correct | 118 ms | 3276 KB | Output is correct |
112 | Correct | 1 ms | 212 KB | Output is correct |
113 | Correct | 1 ms | 212 KB | Output is correct |
114 | Correct | 5 ms | 468 KB | Output is correct |
115 | Correct | 1 ms | 212 KB | Output is correct |
116 | Correct | 9 ms | 720 KB | Output is correct |
117 | Correct | 261 ms | 4912 KB | Output is correct |