#include <bits/stdc++.h>
using namespace std;
long long int dp [50][210][210];
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
852 KB |
Output is correct |
2 |
Correct |
1 ms |
1108 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 |
1236 KB |
Output is correct |
6 |
Correct |
2 ms |
1668 KB |
Output is correct |
7 |
Correct |
1 ms |
1748 KB |
Output is correct |
8 |
Correct |
1 ms |
2128 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 |
2004 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
1236 KB |
Output is correct |
6 |
Correct |
1 ms |
1620 KB |
Output is correct |
7 |
Correct |
1 ms |
1748 KB |
Output is correct |
8 |
Correct |
2 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 |
2004 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
852 KB |
Output is correct |
2 |
Correct |
1 ms |
1108 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
852 KB |
Output is correct |
5 |
Correct |
1 ms |
1236 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 |
1 ms |
2004 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Correct |
1 ms |
2004 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 |
2132 KB |
Output is correct |
15 |
Correct |
2 ms |
2388 KB |
Output is correct |
16 |
Correct |
4 ms |
3540 KB |
Output is correct |
17 |
Correct |
8 ms |
3924 KB |
Output is correct |
18 |
Correct |
8 ms |
4564 KB |
Output is correct |
19 |
Correct |
8 ms |
4580 KB |
Output is correct |
20 |
Correct |
10 ms |
4564 KB |
Output is correct |
21 |
Correct |
8 ms |
4564 KB |
Output is correct |
22 |
Correct |
8 ms |
4564 KB |
Output is correct |
23 |
Correct |
8 ms |
4564 KB |
Output is correct |
24 |
Correct |
9 ms |
4564 KB |
Output is correct |
25 |
Correct |
21 ms |
5808 KB |
Output is correct |
26 |
Correct |
29 ms |
6732 KB |
Output is correct |
27 |
Correct |
47 ms |
7884 KB |
Output is correct |
28 |
Correct |
61 ms |
8628 KB |
Output is correct |
29 |
Incorrect |
60 ms |
8472 KB |
Output isn't correct |
30 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
852 KB |
Output is correct |
2 |
Correct |
1 ms |
1108 KB |
Output is correct |
3 |
Correct |
0 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
852 KB |
Output is correct |
5 |
Correct |
2 ms |
1236 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 |
2 ms |
2004 KB |
Output is correct |
11 |
Correct |
2 ms |
2004 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
896 KB |
Output is correct |
2 |
Correct |
1 ms |
1108 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
852 KB |
Output is correct |
5 |
Correct |
1 ms |
1236 KB |
Output is correct |
6 |
Correct |
1 ms |
1620 KB |
Output is correct |
7 |
Correct |
1 ms |
1748 KB |
Output is correct |
8 |
Correct |
2 ms |
2024 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 |
2004 KB |
Output is correct |
12 |
Correct |
2 ms |
2004 KB |
Output is correct |
13 |
Correct |
2 ms |
2004 KB |
Output is correct |
14 |
Correct |
1 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 |
1876 KB |
Output is correct |
18 |
Correct |
1 ms |
1620 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 |
1 ms |
2004 KB |
Output is correct |
24 |
Correct |
2 ms |
2132 KB |
Output is correct |
25 |
Correct |
2 ms |
2388 KB |
Output is correct |
26 |
Correct |
4 ms |
3540 KB |
Output is correct |
27 |
Correct |
5 ms |
3796 KB |
Output is correct |
28 |
Correct |
8 ms |
4564 KB |
Output is correct |
29 |
Correct |
9 ms |
4564 KB |
Output is correct |
30 |
Correct |
11 ms |
4564 KB |
Output is correct |
31 |
Correct |
8 ms |
4564 KB |
Output is correct |
32 |
Correct |
8 ms |
4564 KB |
Output is correct |
33 |
Correct |
8 ms |
4564 KB |
Output is correct |
34 |
Correct |
9 ms |
4564 KB |
Output is correct |
35 |
Correct |
17 ms |
5724 KB |
Output is correct |
36 |
Correct |
29 ms |
6732 KB |
Output is correct |
37 |
Correct |
46 ms |
7884 KB |
Output is correct |
38 |
Correct |
61 ms |
8652 KB |
Output is correct |
39 |
Incorrect |
61 ms |
8396 KB |
Output isn't correct |
40 |
Halted |
0 ms |
0 KB |
- |