#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2005;
int n, x, y;
ll a[N];
set<ll> dp[N][N];
int main(){
cin >> n >> x >> y;
for (int i = 1; i <= n; i ++)
cin >> a[i], a[i] += a[i - 1], dp[i][1] = {a[i]};
for (int j = 2; j <= n; j ++){
for (int i = j; i <= n; i ++){
for (int k = j - 1; k < i; k ++){
for (ll val : dp[k][j - 1]){
dp[i][j].insert(val | (a[i] - a[k]));
}
}
}
}
ll ans = 1e18;
for (int i = x; i <= y; i ++)
ans = min(ans, *dp[n][i].begin());
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
74 ms |
189008 KB |
Output is correct |
2 |
Correct |
79 ms |
189008 KB |
Output is correct |
3 |
Correct |
70 ms |
189196 KB |
Output is correct |
4 |
Correct |
77 ms |
189168 KB |
Output is correct |
5 |
Correct |
76 ms |
189008 KB |
Output is correct |
6 |
Correct |
77 ms |
189012 KB |
Output is correct |
7 |
Correct |
88 ms |
189268 KB |
Output is correct |
8 |
Correct |
74 ms |
189108 KB |
Output is correct |
9 |
Correct |
76 ms |
189060 KB |
Output is correct |
10 |
Correct |
73 ms |
189264 KB |
Output is correct |
11 |
Correct |
78 ms |
189140 KB |
Output is correct |
12 |
Correct |
77 ms |
189056 KB |
Output is correct |
13 |
Correct |
77 ms |
189264 KB |
Output is correct |
14 |
Correct |
91 ms |
189192 KB |
Output is correct |
15 |
Correct |
70 ms |
189008 KB |
Output is correct |
16 |
Correct |
70 ms |
189008 KB |
Output is correct |
17 |
Correct |
74 ms |
189012 KB |
Output is correct |
18 |
Correct |
77 ms |
189012 KB |
Output is correct |
19 |
Correct |
75 ms |
189256 KB |
Output is correct |
20 |
Correct |
81 ms |
189268 KB |
Output is correct |
21 |
Correct |
78 ms |
189264 KB |
Output is correct |
22 |
Correct |
77 ms |
189264 KB |
Output is correct |
23 |
Correct |
76 ms |
189272 KB |
Output is correct |
24 |
Correct |
74 ms |
189080 KB |
Output is correct |
25 |
Correct |
77 ms |
189164 KB |
Output is correct |
26 |
Correct |
76 ms |
189056 KB |
Output is correct |
27 |
Correct |
75 ms |
189012 KB |
Output is correct |
28 |
Correct |
75 ms |
189268 KB |
Output is correct |
29 |
Correct |
75 ms |
189264 KB |
Output is correct |
30 |
Correct |
77 ms |
189524 KB |
Output is correct |
31 |
Correct |
78 ms |
189268 KB |
Output is correct |
32 |
Correct |
76 ms |
189268 KB |
Output is correct |
33 |
Correct |
74 ms |
189264 KB |
Output is correct |
34 |
Correct |
76 ms |
189104 KB |
Output is correct |
35 |
Correct |
75 ms |
189008 KB |
Output is correct |
36 |
Correct |
81 ms |
189012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
75 ms |
189016 KB |
Output is correct |
2 |
Correct |
75 ms |
189064 KB |
Output is correct |
3 |
Correct |
74 ms |
189144 KB |
Output is correct |
4 |
Correct |
75 ms |
189008 KB |
Output is correct |
5 |
Correct |
81 ms |
189128 KB |
Output is correct |
6 |
Correct |
80 ms |
189104 KB |
Output is correct |
7 |
Correct |
74 ms |
189268 KB |
Output is correct |
8 |
Correct |
75 ms |
189264 KB |
Output is correct |
9 |
Correct |
78 ms |
189080 KB |
Output is correct |
10 |
Correct |
77 ms |
189264 KB |
Output is correct |
11 |
Correct |
76 ms |
189028 KB |
Output is correct |
12 |
Correct |
75 ms |
189088 KB |
Output is correct |
13 |
Correct |
76 ms |
189264 KB |
Output is correct |
14 |
Correct |
77 ms |
189168 KB |
Output is correct |
15 |
Correct |
91 ms |
189072 KB |
Output is correct |
16 |
Correct |
75 ms |
189164 KB |
Output is correct |
17 |
Correct |
100 ms |
189128 KB |
Output is correct |
18 |
Correct |
77 ms |
189012 KB |
Output is correct |
19 |
Correct |
75 ms |
189264 KB |
Output is correct |
20 |
Correct |
75 ms |
189148 KB |
Output is correct |
21 |
Correct |
77 ms |
189264 KB |
Output is correct |
22 |
Correct |
76 ms |
189236 KB |
Output is correct |
23 |
Correct |
75 ms |
189264 KB |
Output is correct |
24 |
Correct |
77 ms |
189268 KB |
Output is correct |
25 |
Correct |
77 ms |
189264 KB |
Output is correct |
26 |
Correct |
78 ms |
189264 KB |
Output is correct |
27 |
Correct |
79 ms |
189268 KB |
Output is correct |
28 |
Correct |
75 ms |
189268 KB |
Output is correct |
29 |
Correct |
79 ms |
189660 KB |
Output is correct |
30 |
Correct |
79 ms |
189776 KB |
Output is correct |
31 |
Correct |
89 ms |
190544 KB |
Output is correct |
32 |
Correct |
85 ms |
189780 KB |
Output is correct |
33 |
Correct |
83 ms |
189776 KB |
Output is correct |
34 |
Correct |
86 ms |
190064 KB |
Output is correct |
35 |
Correct |
85 ms |
190180 KB |
Output is correct |
36 |
Correct |
86 ms |
190292 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
189008 KB |
Output is correct |
2 |
Correct |
80 ms |
189008 KB |
Output is correct |
3 |
Correct |
77 ms |
189008 KB |
Output is correct |
4 |
Correct |
73 ms |
189008 KB |
Output is correct |
5 |
Correct |
76 ms |
189008 KB |
Output is correct |
6 |
Correct |
75 ms |
189212 KB |
Output is correct |
7 |
Correct |
75 ms |
189228 KB |
Output is correct |
8 |
Correct |
76 ms |
189268 KB |
Output is correct |
9 |
Correct |
75 ms |
189264 KB |
Output is correct |
10 |
Correct |
77 ms |
189268 KB |
Output is correct |
11 |
Correct |
84 ms |
189152 KB |
Output is correct |
12 |
Correct |
73 ms |
189264 KB |
Output is correct |
13 |
Correct |
76 ms |
189264 KB |
Output is correct |
14 |
Correct |
76 ms |
189184 KB |
Output is correct |
15 |
Correct |
80 ms |
189520 KB |
Output is correct |
16 |
Correct |
81 ms |
189520 KB |
Output is correct |
17 |
Correct |
79 ms |
189784 KB |
Output is correct |
18 |
Correct |
87 ms |
190596 KB |
Output is correct |
19 |
Correct |
82 ms |
189776 KB |
Output is correct |
20 |
Correct |
83 ms |
189904 KB |
Output is correct |
21 |
Correct |
103 ms |
190036 KB |
Output is correct |
22 |
Correct |
83 ms |
190044 KB |
Output is correct |
23 |
Correct |
84 ms |
190288 KB |
Output is correct |
24 |
Correct |
89 ms |
190536 KB |
Output is correct |
25 |
Correct |
115 ms |
192592 KB |
Output is correct |
26 |
Correct |
156 ms |
194896 KB |
Output is correct |
27 |
Correct |
203 ms |
197360 KB |
Output is correct |
28 |
Correct |
269 ms |
200016 KB |
Output is correct |
29 |
Correct |
182 ms |
196432 KB |
Output is correct |
30 |
Correct |
187 ms |
196688 KB |
Output is correct |
31 |
Correct |
305 ms |
201808 KB |
Output is correct |
32 |
Correct |
281 ms |
201812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
77 ms |
189012 KB |
Output is correct |
2 |
Correct |
82 ms |
189012 KB |
Output is correct |
3 |
Correct |
76 ms |
189008 KB |
Output is correct |
4 |
Correct |
75 ms |
189096 KB |
Output is correct |
5 |
Correct |
75 ms |
189012 KB |
Output is correct |
6 |
Correct |
93 ms |
189044 KB |
Output is correct |
7 |
Correct |
80 ms |
189268 KB |
Output is correct |
8 |
Correct |
77 ms |
189264 KB |
Output is correct |
9 |
Correct |
77 ms |
189268 KB |
Output is correct |
10 |
Correct |
91 ms |
189184 KB |
Output is correct |
11 |
Correct |
71 ms |
189264 KB |
Output is correct |
12 |
Correct |
73 ms |
189264 KB |
Output is correct |
13 |
Correct |
77 ms |
189148 KB |
Output is correct |
14 |
Correct |
77 ms |
189012 KB |
Output is correct |
15 |
Correct |
76 ms |
189016 KB |
Output is correct |
16 |
Correct |
84 ms |
189200 KB |
Output is correct |
17 |
Correct |
78 ms |
189008 KB |
Output is correct |
18 |
Correct |
79 ms |
189040 KB |
Output is correct |
19 |
Correct |
77 ms |
189108 KB |
Output is correct |
20 |
Correct |
78 ms |
189268 KB |
Output is correct |
21 |
Correct |
78 ms |
189520 KB |
Output is correct |
22 |
Correct |
76 ms |
189268 KB |
Output is correct |
23 |
Correct |
75 ms |
189264 KB |
Output is correct |
24 |
Correct |
83 ms |
189268 KB |
Output is correct |
25 |
Correct |
77 ms |
189168 KB |
Output is correct |
26 |
Correct |
78 ms |
189264 KB |
Output is correct |
27 |
Correct |
75 ms |
189008 KB |
Output is correct |
28 |
Correct |
76 ms |
189012 KB |
Output is correct |
29 |
Correct |
77 ms |
189268 KB |
Output is correct |
30 |
Correct |
78 ms |
189520 KB |
Output is correct |
31 |
Correct |
81 ms |
189268 KB |
Output is correct |
32 |
Correct |
75 ms |
189236 KB |
Output is correct |
33 |
Correct |
75 ms |
189056 KB |
Output is correct |
34 |
Correct |
78 ms |
189268 KB |
Output is correct |
35 |
Correct |
78 ms |
189228 KB |
Output is correct |
36 |
Correct |
76 ms |
189012 KB |
Output is correct |
37 |
Correct |
76 ms |
189220 KB |
Output is correct |
38 |
Correct |
73 ms |
189204 KB |
Output is correct |
39 |
Correct |
78 ms |
189524 KB |
Output is correct |
40 |
Correct |
82 ms |
189776 KB |
Output is correct |
41 |
Correct |
94 ms |
190668 KB |
Output is correct |
42 |
Correct |
83 ms |
189824 KB |
Output is correct |
43 |
Correct |
85 ms |
189912 KB |
Output is correct |
44 |
Correct |
79 ms |
190104 KB |
Output is correct |
45 |
Correct |
86 ms |
190164 KB |
Output is correct |
46 |
Correct |
85 ms |
190272 KB |
Output is correct |
47 |
Correct |
89 ms |
190548 KB |
Output is correct |
48 |
Correct |
108 ms |
192596 KB |
Output is correct |
49 |
Correct |
147 ms |
195092 KB |
Output is correct |
50 |
Correct |
190 ms |
197344 KB |
Output is correct |
51 |
Correct |
234 ms |
200016 KB |
Output is correct |
52 |
Correct |
172 ms |
196476 KB |
Output is correct |
53 |
Correct |
183 ms |
196436 KB |
Output is correct |
54 |
Correct |
284 ms |
201812 KB |
Output is correct |
55 |
Correct |
337 ms |
201816 KB |
Output is correct |
56 |
Correct |
439 ms |
224692 KB |
Output is correct |
57 |
Execution timed out |
1025 ms |
262144 KB |
Time limit exceeded |
58 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
189012 KB |
Output is correct |
2 |
Correct |
78 ms |
189236 KB |
Output is correct |
3 |
Correct |
80 ms |
189092 KB |
Output is correct |
4 |
Correct |
83 ms |
189012 KB |
Output is correct |
5 |
Correct |
79 ms |
189220 KB |
Output is correct |
6 |
Correct |
78 ms |
189216 KB |
Output is correct |
7 |
Correct |
78 ms |
189224 KB |
Output is correct |
8 |
Correct |
80 ms |
189268 KB |
Output is correct |
9 |
Correct |
80 ms |
189060 KB |
Output is correct |
10 |
Correct |
80 ms |
189268 KB |
Output is correct |
11 |
Correct |
80 ms |
189268 KB |
Output is correct |
12 |
Correct |
84 ms |
189268 KB |
Output is correct |
13 |
Correct |
80 ms |
189076 KB |
Output is correct |
14 |
Correct |
79 ms |
189152 KB |
Output is correct |
15 |
Correct |
97 ms |
189056 KB |
Output is correct |
16 |
Correct |
97 ms |
189264 KB |
Output is correct |
17 |
Correct |
93 ms |
189528 KB |
Output is correct |
18 |
Correct |
78 ms |
189072 KB |
Output is correct |
19 |
Correct |
80 ms |
189264 KB |
Output is correct |
20 |
Correct |
81 ms |
189248 KB |
Output is correct |
21 |
Correct |
81 ms |
189264 KB |
Output is correct |
22 |
Correct |
82 ms |
189068 KB |
Output is correct |
23 |
Correct |
77 ms |
189136 KB |
Output is correct |
24 |
Correct |
79 ms |
189264 KB |
Output is correct |
25 |
Correct |
80 ms |
189268 KB |
Output is correct |
26 |
Correct |
79 ms |
189664 KB |
Output is correct |
27 |
Correct |
93 ms |
189644 KB |
Output is correct |
28 |
Correct |
93 ms |
190476 KB |
Output is correct |
29 |
Correct |
88 ms |
189780 KB |
Output is correct |
30 |
Correct |
82 ms |
189920 KB |
Output is correct |
31 |
Correct |
84 ms |
190196 KB |
Output is correct |
32 |
Correct |
87 ms |
190036 KB |
Output is correct |
33 |
Correct |
86 ms |
190288 KB |
Output is correct |
34 |
Correct |
94 ms |
190808 KB |
Output is correct |
35 |
Correct |
115 ms |
192596 KB |
Output is correct |
36 |
Correct |
155 ms |
194900 KB |
Output is correct |
37 |
Correct |
199 ms |
197456 KB |
Output is correct |
38 |
Correct |
292 ms |
200020 KB |
Output is correct |
39 |
Correct |
191 ms |
196436 KB |
Output is correct |
40 |
Correct |
174 ms |
196440 KB |
Output is correct |
41 |
Correct |
278 ms |
201808 KB |
Output is correct |
42 |
Correct |
301 ms |
201692 KB |
Output is correct |
43 |
Correct |
450 ms |
224524 KB |
Output is correct |
44 |
Execution timed out |
1044 ms |
262144 KB |
Time limit exceeded |
45 |
Halted |
0 ms |
0 KB |
- |