#include <bits/stdc++.h>
#define int long long
#define iris 998244353
using namespace std;
set<int> dp[2010][2010];
int arr[2010];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,ans,i,j,k,a,b;
cin>>n>>a>>b;
for(i=1;i<=n;i++)
{
cin>>arr[i];
arr[i]+=arr[i-1];
}
dp[0][0].insert(0);
for(i=1;i<=b;i++)
{
for(j=1;j<=n;j++)
{
for(k=0;k<j;k++)
{
for(int ouo:dp[i-1][k])
{
dp[i][j].insert(ouo|(arr[j]-arr[k]));
}
}
}
}
ans=1e18;
for(i=a;i<=b;i++)
{
ans=min(ans, *dp[i][n].lower_bound(-1));
}
cout<<ans<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
107 ms |
190072 KB |
Output is correct |
2 |
Correct |
112 ms |
190072 KB |
Output is correct |
3 |
Correct |
109 ms |
190072 KB |
Output is correct |
4 |
Correct |
107 ms |
190072 KB |
Output is correct |
5 |
Correct |
108 ms |
190072 KB |
Output is correct |
6 |
Correct |
106 ms |
190132 KB |
Output is correct |
7 |
Correct |
106 ms |
190072 KB |
Output is correct |
8 |
Correct |
108 ms |
190072 KB |
Output is correct |
9 |
Correct |
111 ms |
190116 KB |
Output is correct |
10 |
Correct |
106 ms |
190044 KB |
Output is correct |
11 |
Correct |
109 ms |
189944 KB |
Output is correct |
12 |
Correct |
107 ms |
190072 KB |
Output is correct |
13 |
Correct |
119 ms |
190456 KB |
Output is correct |
14 |
Correct |
110 ms |
190072 KB |
Output is correct |
15 |
Correct |
111 ms |
190072 KB |
Output is correct |
16 |
Correct |
109 ms |
190072 KB |
Output is correct |
17 |
Correct |
105 ms |
190072 KB |
Output is correct |
18 |
Correct |
148 ms |
190072 KB |
Output is correct |
19 |
Correct |
106 ms |
190072 KB |
Output is correct |
20 |
Correct |
109 ms |
190072 KB |
Output is correct |
21 |
Correct |
107 ms |
190072 KB |
Output is correct |
22 |
Correct |
146 ms |
190328 KB |
Output is correct |
23 |
Correct |
108 ms |
190072 KB |
Output is correct |
24 |
Correct |
111 ms |
190072 KB |
Output is correct |
25 |
Correct |
108 ms |
190072 KB |
Output is correct |
26 |
Correct |
123 ms |
190292 KB |
Output is correct |
27 |
Correct |
113 ms |
190072 KB |
Output is correct |
28 |
Correct |
106 ms |
190072 KB |
Output is correct |
29 |
Correct |
106 ms |
190200 KB |
Output is correct |
30 |
Correct |
108 ms |
190072 KB |
Output is correct |
31 |
Correct |
107 ms |
190200 KB |
Output is correct |
32 |
Correct |
108 ms |
190072 KB |
Output is correct |
33 |
Correct |
109 ms |
190072 KB |
Output is correct |
34 |
Correct |
107 ms |
190056 KB |
Output is correct |
35 |
Correct |
111 ms |
190272 KB |
Output is correct |
36 |
Correct |
107 ms |
190072 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
108 ms |
190072 KB |
Output is correct |
2 |
Correct |
107 ms |
190072 KB |
Output is correct |
3 |
Correct |
116 ms |
190076 KB |
Output is correct |
4 |
Correct |
110 ms |
190072 KB |
Output is correct |
5 |
Correct |
110 ms |
190072 KB |
Output is correct |
6 |
Correct |
105 ms |
190072 KB |
Output is correct |
7 |
Correct |
107 ms |
190072 KB |
Output is correct |
8 |
Correct |
112 ms |
190036 KB |
Output is correct |
9 |
Correct |
108 ms |
190072 KB |
Output is correct |
10 |
Correct |
108 ms |
190072 KB |
Output is correct |
11 |
Correct |
108 ms |
190072 KB |
Output is correct |
12 |
Correct |
107 ms |
190072 KB |
Output is correct |
13 |
Correct |
107 ms |
190072 KB |
Output is correct |
14 |
Correct |
106 ms |
190072 KB |
Output is correct |
15 |
Correct |
106 ms |
190072 KB |
Output is correct |
16 |
Correct |
108 ms |
190072 KB |
Output is correct |
17 |
Correct |
107 ms |
190136 KB |
Output is correct |
18 |
Correct |
107 ms |
190072 KB |
Output is correct |
19 |
Correct |
106 ms |
190072 KB |
Output is correct |
20 |
Correct |
105 ms |
190072 KB |
Output is correct |
21 |
Correct |
110 ms |
190200 KB |
Output is correct |
22 |
Correct |
115 ms |
190116 KB |
Output is correct |
23 |
Correct |
109 ms |
190072 KB |
Output is correct |
24 |
Correct |
108 ms |
190140 KB |
Output is correct |
25 |
Correct |
109 ms |
190072 KB |
Output is correct |
26 |
Correct |
110 ms |
190076 KB |
Output is correct |
27 |
Correct |
112 ms |
190072 KB |
Output is correct |
28 |
Correct |
113 ms |
190200 KB |
Output is correct |
29 |
Correct |
107 ms |
190200 KB |
Output is correct |
30 |
Correct |
112 ms |
190584 KB |
Output is correct |
31 |
Correct |
129 ms |
191272 KB |
Output is correct |
32 |
Correct |
119 ms |
190712 KB |
Output is correct |
33 |
Correct |
107 ms |
190200 KB |
Output is correct |
34 |
Correct |
121 ms |
190840 KB |
Output is correct |
35 |
Correct |
124 ms |
190968 KB |
Output is correct |
36 |
Correct |
118 ms |
190680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
108 ms |
190072 KB |
Output is correct |
2 |
Correct |
111 ms |
190048 KB |
Output is correct |
3 |
Correct |
112 ms |
190236 KB |
Output is correct |
4 |
Correct |
112 ms |
190072 KB |
Output is correct |
5 |
Correct |
105 ms |
190076 KB |
Output is correct |
6 |
Correct |
107 ms |
190072 KB |
Output is correct |
7 |
Correct |
110 ms |
190072 KB |
Output is correct |
8 |
Correct |
106 ms |
190200 KB |
Output is correct |
9 |
Correct |
107 ms |
190072 KB |
Output is correct |
10 |
Correct |
110 ms |
190072 KB |
Output is correct |
11 |
Correct |
107 ms |
190072 KB |
Output is correct |
12 |
Correct |
106 ms |
190072 KB |
Output is correct |
13 |
Correct |
105 ms |
190072 KB |
Output is correct |
14 |
Correct |
106 ms |
190072 KB |
Output is correct |
15 |
Correct |
106 ms |
190200 KB |
Output is correct |
16 |
Correct |
108 ms |
190200 KB |
Output is correct |
17 |
Correct |
116 ms |
190584 KB |
Output is correct |
18 |
Correct |
123 ms |
191224 KB |
Output is correct |
19 |
Correct |
115 ms |
190632 KB |
Output is correct |
20 |
Correct |
109 ms |
190072 KB |
Output is correct |
21 |
Correct |
124 ms |
190968 KB |
Output is correct |
22 |
Correct |
117 ms |
190840 KB |
Output is correct |
23 |
Correct |
116 ms |
190588 KB |
Output is correct |
24 |
Correct |
127 ms |
191352 KB |
Output is correct |
25 |
Correct |
144 ms |
191608 KB |
Output is correct |
26 |
Correct |
217 ms |
194680 KB |
Output is correct |
27 |
Correct |
306 ms |
198136 KB |
Output is correct |
28 |
Correct |
410 ms |
200936 KB |
Output is correct |
29 |
Correct |
287 ms |
197368 KB |
Output is correct |
30 |
Correct |
110 ms |
190072 KB |
Output is correct |
31 |
Correct |
446 ms |
201976 KB |
Output is correct |
32 |
Correct |
468 ms |
202748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
109 ms |
190072 KB |
Output is correct |
2 |
Correct |
109 ms |
190048 KB |
Output is correct |
3 |
Correct |
106 ms |
190072 KB |
Output is correct |
4 |
Correct |
110 ms |
190200 KB |
Output is correct |
5 |
Correct |
109 ms |
190072 KB |
Output is correct |
6 |
Correct |
106 ms |
190092 KB |
Output is correct |
7 |
Correct |
109 ms |
190072 KB |
Output is correct |
8 |
Correct |
109 ms |
190072 KB |
Output is correct |
9 |
Correct |
110 ms |
190072 KB |
Output is correct |
10 |
Correct |
106 ms |
190072 KB |
Output is correct |
11 |
Correct |
110 ms |
190072 KB |
Output is correct |
12 |
Correct |
109 ms |
190072 KB |
Output is correct |
13 |
Correct |
107 ms |
190176 KB |
Output is correct |
14 |
Correct |
107 ms |
190072 KB |
Output is correct |
15 |
Correct |
108 ms |
190072 KB |
Output is correct |
16 |
Correct |
107 ms |
190072 KB |
Output is correct |
17 |
Correct |
111 ms |
190200 KB |
Output is correct |
18 |
Correct |
105 ms |
190072 KB |
Output is correct |
19 |
Correct |
108 ms |
190072 KB |
Output is correct |
20 |
Correct |
107 ms |
190072 KB |
Output is correct |
21 |
Correct |
110 ms |
190328 KB |
Output is correct |
22 |
Correct |
108 ms |
190200 KB |
Output is correct |
23 |
Correct |
108 ms |
190072 KB |
Output is correct |
24 |
Correct |
106 ms |
190072 KB |
Output is correct |
25 |
Correct |
108 ms |
190072 KB |
Output is correct |
26 |
Correct |
108 ms |
190092 KB |
Output is correct |
27 |
Correct |
108 ms |
190072 KB |
Output is correct |
28 |
Correct |
108 ms |
190072 KB |
Output is correct |
29 |
Correct |
108 ms |
190200 KB |
Output is correct |
30 |
Correct |
110 ms |
190256 KB |
Output is correct |
31 |
Correct |
106 ms |
190200 KB |
Output is correct |
32 |
Correct |
106 ms |
190072 KB |
Output is correct |
33 |
Correct |
106 ms |
190072 KB |
Output is correct |
34 |
Correct |
112 ms |
190328 KB |
Output is correct |
35 |
Correct |
107 ms |
190076 KB |
Output is correct |
36 |
Correct |
107 ms |
190072 KB |
Output is correct |
37 |
Correct |
108 ms |
190072 KB |
Output is correct |
38 |
Correct |
110 ms |
190200 KB |
Output is correct |
39 |
Correct |
112 ms |
190456 KB |
Output is correct |
40 |
Correct |
112 ms |
190716 KB |
Output is correct |
41 |
Correct |
123 ms |
191224 KB |
Output is correct |
42 |
Correct |
116 ms |
190712 KB |
Output is correct |
43 |
Correct |
110 ms |
190328 KB |
Output is correct |
44 |
Correct |
119 ms |
190968 KB |
Output is correct |
45 |
Correct |
116 ms |
190840 KB |
Output is correct |
46 |
Correct |
116 ms |
190584 KB |
Output is correct |
47 |
Correct |
132 ms |
191484 KB |
Output is correct |
48 |
Correct |
143 ms |
191608 KB |
Output is correct |
49 |
Correct |
220 ms |
194680 KB |
Output is correct |
50 |
Correct |
311 ms |
198392 KB |
Output is correct |
51 |
Correct |
412 ms |
200952 KB |
Output is correct |
52 |
Correct |
288 ms |
197496 KB |
Output is correct |
53 |
Correct |
109 ms |
190072 KB |
Output is correct |
54 |
Correct |
450 ms |
201976 KB |
Output is correct |
55 |
Correct |
465 ms |
202796 KB |
Output is correct |
56 |
Correct |
683 ms |
225272 KB |
Output is correct |
57 |
Execution timed out |
1106 ms |
249176 KB |
Time limit exceeded |
58 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
107 ms |
190072 KB |
Output is correct |
2 |
Correct |
106 ms |
190132 KB |
Output is correct |
3 |
Correct |
108 ms |
190072 KB |
Output is correct |
4 |
Correct |
116 ms |
190072 KB |
Output is correct |
5 |
Correct |
107 ms |
190072 KB |
Output is correct |
6 |
Correct |
106 ms |
190072 KB |
Output is correct |
7 |
Correct |
107 ms |
190140 KB |
Output is correct |
8 |
Correct |
112 ms |
190072 KB |
Output is correct |
9 |
Correct |
109 ms |
190072 KB |
Output is correct |
10 |
Correct |
106 ms |
190072 KB |
Output is correct |
11 |
Correct |
109 ms |
190104 KB |
Output is correct |
12 |
Correct |
108 ms |
190072 KB |
Output is correct |
13 |
Correct |
107 ms |
190100 KB |
Output is correct |
14 |
Correct |
107 ms |
190072 KB |
Output is correct |
15 |
Correct |
110 ms |
190072 KB |
Output is correct |
16 |
Correct |
110 ms |
190200 KB |
Output is correct |
17 |
Correct |
106 ms |
190072 KB |
Output is correct |
18 |
Correct |
113 ms |
190072 KB |
Output is correct |
19 |
Correct |
109 ms |
190072 KB |
Output is correct |
20 |
Correct |
112 ms |
190328 KB |
Output is correct |
21 |
Correct |
105 ms |
190200 KB |
Output is correct |
22 |
Correct |
105 ms |
190072 KB |
Output is correct |
23 |
Correct |
107 ms |
190072 KB |
Output is correct |
24 |
Correct |
108 ms |
190200 KB |
Output is correct |
25 |
Correct |
110 ms |
190328 KB |
Output is correct |
26 |
Correct |
107 ms |
190200 KB |
Output is correct |
27 |
Correct |
116 ms |
190584 KB |
Output is correct |
28 |
Correct |
122 ms |
191224 KB |
Output is correct |
29 |
Correct |
117 ms |
190724 KB |
Output is correct |
30 |
Correct |
107 ms |
190072 KB |
Output is correct |
31 |
Correct |
122 ms |
190840 KB |
Output is correct |
32 |
Correct |
121 ms |
190840 KB |
Output is correct |
33 |
Correct |
122 ms |
190600 KB |
Output is correct |
34 |
Correct |
125 ms |
191480 KB |
Output is correct |
35 |
Correct |
138 ms |
191608 KB |
Output is correct |
36 |
Correct |
219 ms |
194680 KB |
Output is correct |
37 |
Correct |
307 ms |
198264 KB |
Output is correct |
38 |
Correct |
404 ms |
200952 KB |
Output is correct |
39 |
Correct |
293 ms |
197408 KB |
Output is correct |
40 |
Correct |
109 ms |
190076 KB |
Output is correct |
41 |
Correct |
446 ms |
202028 KB |
Output is correct |
42 |
Correct |
468 ms |
202744 KB |
Output is correct |
43 |
Correct |
676 ms |
225400 KB |
Output is correct |
44 |
Execution timed out |
1110 ms |
249080 KB |
Time limit exceeded |
45 |
Halted |
0 ms |
0 KB |
- |