#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+1; 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 |
0 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 |
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 |
852 KB |
Output is correct |
15 |
Correct |
1 ms |
852 KB |
Output is correct |
16 |
Correct |
1 ms |
852 KB |
Output is correct |
17 |
Correct |
1 ms |
852 KB |
Output is correct |
18 |
Correct |
1 ms |
1236 KB |
Output is correct |
19 |
Correct |
1 ms |
1620 KB |
Output is correct |
20 |
Correct |
1 ms |
1748 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 |
1980 KB |
Output is correct |
24 |
Correct |
1 ms |
2004 KB |
Output is correct |
25 |
Correct |
2 ms |
2004 KB |
Output is correct |
26 |
Correct |
1 ms |
2004 KB |
Output is correct |
27 |
Correct |
0 ms |
724 KB |
Output is correct |
28 |
Correct |
1 ms |
980 KB |
Output is correct |
29 |
Correct |
1 ms |
1364 KB |
Output is correct |
30 |
Correct |
1 ms |
1876 KB |
Output is correct |
31 |
Correct |
1 ms |
1620 KB |
Output is correct |
32 |
Correct |
1 ms |
1108 KB |
Output is correct |
33 |
Correct |
1 ms |
2004 KB |
Output is correct |
34 |
Correct |
1 ms |
2004 KB |
Output is correct |
35 |
Correct |
1 ms |
2004 KB |
Output is correct |
36 |
Correct |
1 ms |
2004 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
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 |
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 |
Correct |
1 ms |
852 KB |
Output is correct |
16 |
Correct |
1 ms |
852 KB |
Output is correct |
17 |
Correct |
1 ms |
852 KB |
Output is correct |
18 |
Correct |
1 ms |
1236 KB |
Output is correct |
19 |
Correct |
1 ms |
1620 KB |
Output is correct |
20 |
Correct |
1 ms |
1748 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 |
1 ms |
2004 KB |
Output is correct |
25 |
Correct |
1 ms |
2004 KB |
Output is correct |
26 |
Correct |
1 ms |
2004 KB |
Output is correct |
27 |
Correct |
2 ms |
2132 KB |
Output is correct |
28 |
Correct |
2 ms |
2388 KB |
Output is correct |
29 |
Correct |
4 ms |
3540 KB |
Output is correct |
30 |
Correct |
6 ms |
3796 KB |
Output is correct |
31 |
Correct |
8 ms |
4520 KB |
Output is correct |
32 |
Correct |
9 ms |
4556 KB |
Output is correct |
33 |
Correct |
8 ms |
4496 KB |
Output is correct |
34 |
Correct |
8 ms |
4524 KB |
Output is correct |
35 |
Correct |
8 ms |
4564 KB |
Output is correct |
36 |
Correct |
8 ms |
4508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
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 |
1 ms |
2004 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 |
2132 KB |
Output is correct |
15 |
Correct |
2 ms |
2388 KB |
Output is correct |
16 |
Correct |
6 ms |
3504 KB |
Output is correct |
17 |
Correct |
5 ms |
3796 KB |
Output is correct |
18 |
Correct |
8 ms |
4468 KB |
Output is correct |
19 |
Correct |
9 ms |
4564 KB |
Output is correct |
20 |
Correct |
8 ms |
4564 KB |
Output is correct |
21 |
Correct |
8 ms |
4484 KB |
Output is correct |
22 |
Correct |
9 ms |
4564 KB |
Output is correct |
23 |
Correct |
8 ms |
4564 KB |
Output is correct |
24 |
Correct |
9 ms |
4544 KB |
Output is correct |
25 |
Correct |
17 ms |
5736 KB |
Output is correct |
26 |
Correct |
34 ms |
6756 KB |
Output is correct |
27 |
Correct |
47 ms |
7884 KB |
Output is correct |
28 |
Correct |
63 ms |
8580 KB |
Output is correct |
29 |
Correct |
66 ms |
8516 KB |
Output is correct |
30 |
Correct |
63 ms |
8576 KB |
Output is correct |
31 |
Correct |
64 ms |
8592 KB |
Output is correct |
32 |
Correct |
63 ms |
8544 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
848 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 |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
2 ms |
2004 KB |
Output is correct |
10 |
Correct |
1 ms |
2000 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 |
Correct |
1 ms |
852 KB |
Output is correct |
16 |
Correct |
1 ms |
852 KB |
Output is correct |
17 |
Correct |
0 ms |
852 KB |
Output is correct |
18 |
Correct |
1 ms |
1236 KB |
Output is correct |
19 |
Correct |
1 ms |
1620 KB |
Output is correct |
20 |
Correct |
1 ms |
1748 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 |
2008 KB |
Output is correct |
25 |
Correct |
1 ms |
2004 KB |
Output is correct |
26 |
Correct |
1 ms |
2004 KB |
Output is correct |
27 |
Correct |
1 ms |
724 KB |
Output is correct |
28 |
Correct |
1 ms |
980 KB |
Output is correct |
29 |
Correct |
1 ms |
1364 KB |
Output is correct |
30 |
Correct |
1 ms |
1876 KB |
Output is correct |
31 |
Correct |
2 ms |
1620 KB |
Output is correct |
32 |
Correct |
1 ms |
1108 KB |
Output is correct |
33 |
Correct |
1 ms |
2092 KB |
Output is correct |
34 |
Correct |
1 ms |
2004 KB |
Output is correct |
35 |
Correct |
1 ms |
2004 KB |
Output is correct |
36 |
Correct |
1 ms |
2004 KB |
Output is correct |
37 |
Correct |
1 ms |
2132 KB |
Output is correct |
38 |
Correct |
2 ms |
2388 KB |
Output is correct |
39 |
Correct |
4 ms |
3528 KB |
Output is correct |
40 |
Correct |
5 ms |
3796 KB |
Output is correct |
41 |
Correct |
8 ms |
4564 KB |
Output is correct |
42 |
Correct |
10 ms |
4564 KB |
Output is correct |
43 |
Correct |
10 ms |
4564 KB |
Output is correct |
44 |
Correct |
9 ms |
4472 KB |
Output is correct |
45 |
Correct |
8 ms |
4564 KB |
Output is correct |
46 |
Correct |
8 ms |
4468 KB |
Output is correct |
47 |
Correct |
9 ms |
4564 KB |
Output is correct |
48 |
Correct |
17 ms |
5760 KB |
Output is correct |
49 |
Correct |
30 ms |
6776 KB |
Output is correct |
50 |
Correct |
47 ms |
7832 KB |
Output is correct |
51 |
Correct |
63 ms |
8552 KB |
Output is correct |
52 |
Correct |
65 ms |
8328 KB |
Output is correct |
53 |
Correct |
64 ms |
8636 KB |
Output is correct |
54 |
Correct |
63 ms |
8668 KB |
Output is correct |
55 |
Correct |
63 ms |
8536 KB |
Output is correct |
56 |
Correct |
7 ms |
4436 KB |
Output is correct |
57 |
Correct |
22 ms |
6744 KB |
Output is correct |
58 |
Correct |
33 ms |
7628 KB |
Output is correct |
59 |
Correct |
54 ms |
8288 KB |
Output is correct |
60 |
Correct |
42 ms |
6452 KB |
Output is correct |
61 |
Correct |
44 ms |
4432 KB |
Output is correct |
62 |
Correct |
45 ms |
8616 KB |
Output is correct |
63 |
Correct |
50 ms |
8552 KB |
Output is correct |
64 |
Correct |
48 ms |
7780 KB |
Output is correct |
65 |
Correct |
7 ms |
4308 KB |
Output is correct |
66 |
Correct |
16 ms |
5596 KB |
Output is correct |
67 |
Correct |
29 ms |
6580 KB |
Output is correct |
68 |
Correct |
33 ms |
7864 KB |
Output is correct |
69 |
Correct |
45 ms |
8316 KB |
Output is correct |
70 |
Correct |
41 ms |
6504 KB |
Output is correct |
71 |
Correct |
42 ms |
5744 KB |
Output is correct |
72 |
Correct |
46 ms |
8600 KB |
Output is correct |
73 |
Correct |
46 ms |
8640 KB |
Output is correct |
74 |
Correct |
47 ms |
8652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
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 |
2076 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 |
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 |
2 ms |
2004 KB |
Output is correct |
23 |
Correct |
2 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 |
5 ms |
3540 KB |
Output is correct |
27 |
Correct |
5 ms |
3808 KB |
Output is correct |
28 |
Correct |
11 ms |
4564 KB |
Output is correct |
29 |
Correct |
9 ms |
4468 KB |
Output is correct |
30 |
Correct |
8 ms |
4564 KB |
Output is correct |
31 |
Correct |
8 ms |
4564 KB |
Output is correct |
32 |
Correct |
8 ms |
4492 KB |
Output is correct |
33 |
Correct |
8 ms |
4564 KB |
Output is correct |
34 |
Correct |
9 ms |
4564 KB |
Output is correct |
35 |
Correct |
18 ms |
5692 KB |
Output is correct |
36 |
Correct |
32 ms |
6828 KB |
Output is correct |
37 |
Correct |
48 ms |
7828 KB |
Output is correct |
38 |
Correct |
67 ms |
8596 KB |
Output is correct |
39 |
Correct |
63 ms |
8316 KB |
Output is correct |
40 |
Correct |
62 ms |
8644 KB |
Output is correct |
41 |
Correct |
62 ms |
8600 KB |
Output is correct |
42 |
Correct |
62 ms |
8544 KB |
Output is correct |
43 |
Correct |
7 ms |
4496 KB |
Output is correct |
44 |
Correct |
26 ms |
6704 KB |
Output is correct |
45 |
Correct |
33 ms |
7644 KB |
Output is correct |
46 |
Correct |
45 ms |
8320 KB |
Output is correct |
47 |
Correct |
42 ms |
6520 KB |
Output is correct |
48 |
Correct |
42 ms |
4392 KB |
Output is correct |
49 |
Correct |
46 ms |
8652 KB |
Output is correct |
50 |
Correct |
45 ms |
8568 KB |
Output is correct |
51 |
Correct |
44 ms |
8492 KB |
Output is correct |
52 |
Runtime error |
41 ms |
1104 KB |
Execution killed with signal 11 |
53 |
Halted |
0 ms |
0 KB |
- |