#include <bits/stdc++.h>
using namespace std;
long long int dp [50][200][200];
long long int l [2010];
long long int pref [210];
int main (){
int n, gra, grb; cin >> n >> gra >> grb;
for (int i=0; i<n; i++) cin >> l [i];
pref [0]=l [0];
for (int i=1; i<n; i++) pref [i]=pref [i-1]+l [i];
long long int ans=0;
for (long long int b=49; b>=0; b--){
for (int i=0; i<n; i++){
for (int j=0; j<n; j++){
if ((((ans >> b) | ((pref [i])>>b)) == (ans >> b))) dp [b][i][1]=1;
for (int k=i-1; k>=0; k--){
if ((((ans >> b) | ((pref [i]-pref [k])>>b)) == (ans >> b))) dp [b][i][j]=max (dp [b][i][j], dp [b][k][j-1]);
}
}
}
int da=0;
for (int i=gra; i<=grb; i++) if (dp [b][n-1][i]) da=1;
if (!da) ans|=((long long)1<<b);
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
852 KB |
Output is correct |
2 |
Correct |
1 ms |
980 KB |
Output is correct |
3 |
Correct |
0 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
852 KB |
Output is correct |
5 |
Correct |
1 ms |
1108 KB |
Output is correct |
6 |
Correct |
1 ms |
1620 KB |
Output is correct |
7 |
Correct |
1 ms |
1748 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
1 ms |
2004 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Correct |
1 ms |
1876 KB |
Output is correct |
12 |
Correct |
1 ms |
2004 KB |
Output is correct |
13 |
Correct |
2 ms |
2004 KB |
Output is correct |
14 |
Correct |
1 ms |
852 KB |
Output is correct |
15 |
Incorrect |
1 ms |
852 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
852 KB |
Output is correct |
2 |
Correct |
1 ms |
980 KB |
Output is correct |
3 |
Correct |
0 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
872 KB |
Output is correct |
5 |
Correct |
1 ms |
1108 KB |
Output is correct |
6 |
Correct |
1 ms |
1620 KB |
Output is correct |
7 |
Correct |
1 ms |
1748 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
1 ms |
2004 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Correct |
1 ms |
1876 KB |
Output is correct |
12 |
Correct |
2 ms |
2004 KB |
Output is correct |
13 |
Correct |
1 ms |
2004 KB |
Output is correct |
14 |
Correct |
1 ms |
852 KB |
Output is correct |
15 |
Incorrect |
1 ms |
852 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
852 KB |
Output is correct |
2 |
Correct |
1 ms |
980 KB |
Output is correct |
3 |
Correct |
0 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
852 KB |
Output is correct |
5 |
Correct |
1 ms |
1108 KB |
Output is correct |
6 |
Correct |
1 ms |
1620 KB |
Output is correct |
7 |
Correct |
1 ms |
1748 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
1 ms |
2004 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Correct |
1 ms |
1876 KB |
Output is correct |
12 |
Correct |
1 ms |
2004 KB |
Output is correct |
13 |
Correct |
2 ms |
2004 KB |
Output is correct |
14 |
Correct |
1 ms |
2004 KB |
Output is correct |
15 |
Correct |
2 ms |
2388 KB |
Output is correct |
16 |
Correct |
4 ms |
3320 KB |
Output is correct |
17 |
Correct |
6 ms |
3732 KB |
Output is correct |
18 |
Correct |
8 ms |
4308 KB |
Output is correct |
19 |
Correct |
8 ms |
4312 KB |
Output is correct |
20 |
Correct |
8 ms |
4308 KB |
Output is correct |
21 |
Correct |
8 ms |
4324 KB |
Output is correct |
22 |
Correct |
8 ms |
4308 KB |
Output is correct |
23 |
Correct |
10 ms |
4308 KB |
Output is correct |
24 |
Correct |
9 ms |
4372 KB |
Output is correct |
25 |
Correct |
17 ms |
5468 KB |
Output is correct |
26 |
Correct |
30 ms |
6456 KB |
Output is correct |
27 |
Correct |
46 ms |
7580 KB |
Output is correct |
28 |
Correct |
65 ms |
8256 KB |
Output is correct |
29 |
Incorrect |
60 ms |
8116 KB |
Output isn't correct |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
852 KB |
Output is correct |
2 |
Correct |
1 ms |
980 KB |
Output is correct |
3 |
Correct |
0 ms |
468 KB |
Output is correct |
4 |
Correct |
0 ms |
852 KB |
Output is correct |
5 |
Correct |
1 ms |
1108 KB |
Output is correct |
6 |
Correct |
2 ms |
1620 KB |
Output is correct |
7 |
Correct |
1 ms |
1748 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
2 ms |
2004 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Correct |
2 ms |
1876 KB |
Output is correct |
12 |
Correct |
1 ms |
2004 KB |
Output is correct |
13 |
Correct |
1 ms |
2004 KB |
Output is correct |
14 |
Correct |
1 ms |
852 KB |
Output is correct |
15 |
Incorrect |
1 ms |
852 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
852 KB |
Output is correct |
2 |
Correct |
1 ms |
980 KB |
Output is correct |
3 |
Correct |
0 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
852 KB |
Output is correct |
5 |
Correct |
1 ms |
1108 KB |
Output is correct |
6 |
Correct |
1 ms |
1620 KB |
Output is correct |
7 |
Correct |
2 ms |
1748 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
2 ms |
2004 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Correct |
1 ms |
1876 KB |
Output is correct |
12 |
Correct |
1 ms |
2024 KB |
Output is correct |
13 |
Correct |
1 ms |
2004 KB |
Output is correct |
14 |
Correct |
0 ms |
724 KB |
Output is correct |
15 |
Correct |
1 ms |
980 KB |
Output is correct |
16 |
Correct |
1 ms |
1364 KB |
Output is correct |
17 |
Correct |
1 ms |
1748 KB |
Output is correct |
18 |
Correct |
1 ms |
1492 KB |
Output is correct |
19 |
Correct |
1 ms |
1108 KB |
Output is correct |
20 |
Correct |
1 ms |
2004 KB |
Output is correct |
21 |
Correct |
1 ms |
2004 KB |
Output is correct |
22 |
Correct |
1 ms |
2004 KB |
Output is correct |
23 |
Correct |
2 ms |
2004 KB |
Output is correct |
24 |
Correct |
1 ms |
2004 KB |
Output is correct |
25 |
Correct |
2 ms |
2388 KB |
Output is correct |
26 |
Correct |
4 ms |
3412 KB |
Output is correct |
27 |
Correct |
5 ms |
3668 KB |
Output is correct |
28 |
Correct |
8 ms |
4296 KB |
Output is correct |
29 |
Correct |
8 ms |
4264 KB |
Output is correct |
30 |
Correct |
8 ms |
4376 KB |
Output is correct |
31 |
Correct |
8 ms |
4308 KB |
Output is correct |
32 |
Correct |
8 ms |
4308 KB |
Output is correct |
33 |
Correct |
8 ms |
4320 KB |
Output is correct |
34 |
Correct |
8 ms |
4436 KB |
Output is correct |
35 |
Correct |
17 ms |
5460 KB |
Output is correct |
36 |
Correct |
32 ms |
6576 KB |
Output is correct |
37 |
Correct |
46 ms |
7548 KB |
Output is correct |
38 |
Correct |
66 ms |
8284 KB |
Output is correct |
39 |
Incorrect |
65 ms |
8124 KB |
Output isn't correct |
40 |
Halted |
0 ms |
0 KB |
- |