#include <iostream>
#include <fstream>
using namespace std;
const int nmax=2005;
long long v[nmax];
bool dp[105][105];
long long sum,frb,ans;
int n,i,j,k,a,b;
bool chk_brt(long long val)
{
dp[0][0]=1;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
dp[i][j]=0;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
sum=0;
for(k=j;k>=1;k--)
{
sum+=v[k];
if((sum&frb)==0)
dp[i][j]|=dp[i-1][k-1];
}
if(i>=a&&i<=b&&dp[i][n])
return 1;
}
return 0;
}
bool check(long long val)
{
frb=(((1LL<<61)-1)^val);
if(n<=100) return chk_brt(val);
return 0;
}
int main()
{
//freopen("data.in","r",stdin);
cin>>n>>a>>b;
for(i=1;i<=n;i++)
cin>>v[i];
ans=(1LL<<61)-1;
for(long long p=60;p>=0;p--)
if(check(ans-(1LL<<p)))
ans-=(1LL<<p);
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
448 KB |
Output is correct |
4 |
Correct |
2 ms |
560 KB |
Output is correct |
5 |
Correct |
2 ms |
640 KB |
Output is correct |
6 |
Correct |
2 ms |
644 KB |
Output is correct |
7 |
Correct |
2 ms |
644 KB |
Output is correct |
8 |
Correct |
2 ms |
652 KB |
Output is correct |
9 |
Correct |
2 ms |
656 KB |
Output is correct |
10 |
Correct |
2 ms |
656 KB |
Output is correct |
11 |
Correct |
2 ms |
784 KB |
Output is correct |
12 |
Correct |
2 ms |
788 KB |
Output is correct |
13 |
Correct |
2 ms |
788 KB |
Output is correct |
14 |
Correct |
2 ms |
788 KB |
Output is correct |
15 |
Correct |
2 ms |
788 KB |
Output is correct |
16 |
Correct |
2 ms |
788 KB |
Output is correct |
17 |
Correct |
2 ms |
788 KB |
Output is correct |
18 |
Correct |
2 ms |
788 KB |
Output is correct |
19 |
Correct |
2 ms |
788 KB |
Output is correct |
20 |
Correct |
2 ms |
788 KB |
Output is correct |
21 |
Correct |
2 ms |
788 KB |
Output is correct |
22 |
Correct |
2 ms |
788 KB |
Output is correct |
23 |
Correct |
2 ms |
788 KB |
Output is correct |
24 |
Correct |
2 ms |
872 KB |
Output is correct |
25 |
Correct |
2 ms |
872 KB |
Output is correct |
26 |
Correct |
2 ms |
872 KB |
Output is correct |
27 |
Correct |
2 ms |
872 KB |
Output is correct |
28 |
Correct |
2 ms |
872 KB |
Output is correct |
29 |
Correct |
2 ms |
872 KB |
Output is correct |
30 |
Correct |
2 ms |
872 KB |
Output is correct |
31 |
Correct |
2 ms |
872 KB |
Output is correct |
32 |
Correct |
2 ms |
872 KB |
Output is correct |
33 |
Correct |
2 ms |
872 KB |
Output is correct |
34 |
Correct |
2 ms |
872 KB |
Output is correct |
35 |
Correct |
2 ms |
872 KB |
Output is correct |
36 |
Correct |
2 ms |
872 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
872 KB |
Output is correct |
2 |
Correct |
2 ms |
872 KB |
Output is correct |
3 |
Correct |
2 ms |
872 KB |
Output is correct |
4 |
Correct |
2 ms |
872 KB |
Output is correct |
5 |
Correct |
2 ms |
872 KB |
Output is correct |
6 |
Correct |
2 ms |
884 KB |
Output is correct |
7 |
Correct |
2 ms |
884 KB |
Output is correct |
8 |
Correct |
2 ms |
892 KB |
Output is correct |
9 |
Correct |
2 ms |
896 KB |
Output is correct |
10 |
Correct |
2 ms |
916 KB |
Output is correct |
11 |
Correct |
2 ms |
916 KB |
Output is correct |
12 |
Correct |
2 ms |
916 KB |
Output is correct |
13 |
Correct |
2 ms |
928 KB |
Output is correct |
14 |
Correct |
2 ms |
928 KB |
Output is correct |
15 |
Correct |
2 ms |
928 KB |
Output is correct |
16 |
Correct |
2 ms |
928 KB |
Output is correct |
17 |
Correct |
2 ms |
928 KB |
Output is correct |
18 |
Correct |
2 ms |
948 KB |
Output is correct |
19 |
Correct |
2 ms |
948 KB |
Output is correct |
20 |
Correct |
2 ms |
956 KB |
Output is correct |
21 |
Correct |
2 ms |
956 KB |
Output is correct |
22 |
Correct |
2 ms |
956 KB |
Output is correct |
23 |
Correct |
2 ms |
968 KB |
Output is correct |
24 |
Correct |
2 ms |
968 KB |
Output is correct |
25 |
Correct |
2 ms |
980 KB |
Output is correct |
26 |
Correct |
2 ms |
984 KB |
Output is correct |
27 |
Correct |
2 ms |
984 KB |
Output is correct |
28 |
Correct |
2 ms |
984 KB |
Output is correct |
29 |
Correct |
2 ms |
984 KB |
Output is correct |
30 |
Correct |
2 ms |
984 KB |
Output is correct |
31 |
Correct |
2 ms |
1004 KB |
Output is correct |
32 |
Correct |
3 ms |
1004 KB |
Output is correct |
33 |
Correct |
2 ms |
1012 KB |
Output is correct |
34 |
Correct |
3 ms |
1048 KB |
Output is correct |
35 |
Correct |
2 ms |
1052 KB |
Output is correct |
36 |
Correct |
3 ms |
1056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1188 KB |
Output is correct |
2 |
Correct |
2 ms |
1196 KB |
Output is correct |
3 |
Correct |
2 ms |
1196 KB |
Output is correct |
4 |
Correct |
2 ms |
1196 KB |
Output is correct |
5 |
Correct |
2 ms |
1196 KB |
Output is correct |
6 |
Correct |
2 ms |
1196 KB |
Output is correct |
7 |
Correct |
2 ms |
1220 KB |
Output is correct |
8 |
Correct |
2 ms |
1224 KB |
Output is correct |
9 |
Correct |
2 ms |
1228 KB |
Output is correct |
10 |
Correct |
2 ms |
1232 KB |
Output is correct |
11 |
Correct |
2 ms |
1236 KB |
Output is correct |
12 |
Correct |
2 ms |
1364 KB |
Output is correct |
13 |
Correct |
2 ms |
1364 KB |
Output is correct |
14 |
Correct |
2 ms |
1364 KB |
Output is correct |
15 |
Correct |
2 ms |
1364 KB |
Output is correct |
16 |
Correct |
2 ms |
1364 KB |
Output is correct |
17 |
Correct |
2 ms |
1364 KB |
Output is correct |
18 |
Correct |
3 ms |
1364 KB |
Output is correct |
19 |
Correct |
2 ms |
1364 KB |
Output is correct |
20 |
Correct |
3 ms |
1364 KB |
Output is correct |
21 |
Correct |
3 ms |
1364 KB |
Output is correct |
22 |
Correct |
3 ms |
1364 KB |
Output is correct |
23 |
Correct |
3 ms |
1364 KB |
Output is correct |
24 |
Correct |
2 ms |
1364 KB |
Output is correct |
25 |
Correct |
3 ms |
1364 KB |
Output is correct |
26 |
Correct |
4 ms |
1364 KB |
Output is correct |
27 |
Correct |
5 ms |
1364 KB |
Output is correct |
28 |
Correct |
6 ms |
1364 KB |
Output is correct |
29 |
Correct |
6 ms |
1364 KB |
Output is correct |
30 |
Correct |
9 ms |
1364 KB |
Output is correct |
31 |
Correct |
6 ms |
1364 KB |
Output is correct |
32 |
Correct |
6 ms |
1364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1364 KB |
Output is correct |
2 |
Correct |
2 ms |
1364 KB |
Output is correct |
3 |
Correct |
1 ms |
1364 KB |
Output is correct |
4 |
Correct |
2 ms |
1372 KB |
Output is correct |
5 |
Correct |
2 ms |
1376 KB |
Output is correct |
6 |
Correct |
2 ms |
1380 KB |
Output is correct |
7 |
Correct |
2 ms |
1380 KB |
Output is correct |
8 |
Correct |
2 ms |
1380 KB |
Output is correct |
9 |
Correct |
2 ms |
1380 KB |
Output is correct |
10 |
Correct |
2 ms |
1380 KB |
Output is correct |
11 |
Correct |
2 ms |
1400 KB |
Output is correct |
12 |
Correct |
2 ms |
1528 KB |
Output is correct |
13 |
Correct |
2 ms |
1528 KB |
Output is correct |
14 |
Correct |
2 ms |
1528 KB |
Output is correct |
15 |
Correct |
2 ms |
1528 KB |
Output is correct |
16 |
Correct |
2 ms |
1528 KB |
Output is correct |
17 |
Correct |
2 ms |
1528 KB |
Output is correct |
18 |
Correct |
2 ms |
1528 KB |
Output is correct |
19 |
Correct |
2 ms |
1528 KB |
Output is correct |
20 |
Correct |
2 ms |
1528 KB |
Output is correct |
21 |
Correct |
2 ms |
1528 KB |
Output is correct |
22 |
Correct |
2 ms |
1528 KB |
Output is correct |
23 |
Correct |
2 ms |
1528 KB |
Output is correct |
24 |
Correct |
2 ms |
1528 KB |
Output is correct |
25 |
Correct |
2 ms |
1528 KB |
Output is correct |
26 |
Correct |
2 ms |
1528 KB |
Output is correct |
27 |
Correct |
2 ms |
1528 KB |
Output is correct |
28 |
Correct |
2 ms |
1528 KB |
Output is correct |
29 |
Correct |
2 ms |
1528 KB |
Output is correct |
30 |
Correct |
2 ms |
1528 KB |
Output is correct |
31 |
Correct |
2 ms |
1528 KB |
Output is correct |
32 |
Correct |
2 ms |
1528 KB |
Output is correct |
33 |
Correct |
2 ms |
1612 KB |
Output is correct |
34 |
Correct |
2 ms |
1612 KB |
Output is correct |
35 |
Correct |
2 ms |
1612 KB |
Output is correct |
36 |
Correct |
2 ms |
1612 KB |
Output is correct |
37 |
Correct |
2 ms |
1612 KB |
Output is correct |
38 |
Correct |
2 ms |
1612 KB |
Output is correct |
39 |
Correct |
2 ms |
1612 KB |
Output is correct |
40 |
Correct |
2 ms |
1648 KB |
Output is correct |
41 |
Correct |
2 ms |
1648 KB |
Output is correct |
42 |
Correct |
2 ms |
1684 KB |
Output is correct |
43 |
Correct |
2 ms |
1684 KB |
Output is correct |
44 |
Correct |
2 ms |
1684 KB |
Output is correct |
45 |
Correct |
2 ms |
1684 KB |
Output is correct |
46 |
Correct |
3 ms |
1684 KB |
Output is correct |
47 |
Correct |
3 ms |
1684 KB |
Output is correct |
48 |
Correct |
3 ms |
1684 KB |
Output is correct |
49 |
Correct |
4 ms |
1684 KB |
Output is correct |
50 |
Correct |
5 ms |
1684 KB |
Output is correct |
51 |
Correct |
6 ms |
1684 KB |
Output is correct |
52 |
Correct |
6 ms |
1684 KB |
Output is correct |
53 |
Correct |
6 ms |
1684 KB |
Output is correct |
54 |
Correct |
5 ms |
1684 KB |
Output is correct |
55 |
Correct |
6 ms |
1684 KB |
Output is correct |
56 |
Correct |
5 ms |
1684 KB |
Output is correct |
57 |
Correct |
12 ms |
1684 KB |
Output is correct |
58 |
Correct |
15 ms |
1684 KB |
Output is correct |
59 |
Correct |
19 ms |
1684 KB |
Output is correct |
60 |
Correct |
18 ms |
1684 KB |
Output is correct |
61 |
Correct |
13 ms |
1684 KB |
Output is correct |
62 |
Correct |
18 ms |
1684 KB |
Output is correct |
63 |
Correct |
18 ms |
1684 KB |
Output is correct |
64 |
Correct |
21 ms |
1688 KB |
Output is correct |
65 |
Correct |
5 ms |
1692 KB |
Output is correct |
66 |
Correct |
7 ms |
1696 KB |
Output is correct |
67 |
Correct |
11 ms |
1700 KB |
Output is correct |
68 |
Correct |
19 ms |
1704 KB |
Output is correct |
69 |
Correct |
33 ms |
1708 KB |
Output is correct |
70 |
Correct |
33 ms |
1712 KB |
Output is correct |
71 |
Correct |
14 ms |
1716 KB |
Output is correct |
72 |
Correct |
19 ms |
1724 KB |
Output is correct |
73 |
Correct |
33 ms |
1728 KB |
Output is correct |
74 |
Correct |
27 ms |
1732 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1732 KB |
Output is correct |
2 |
Correct |
2 ms |
1732 KB |
Output is correct |
3 |
Correct |
2 ms |
1732 KB |
Output is correct |
4 |
Correct |
2 ms |
1732 KB |
Output is correct |
5 |
Correct |
2 ms |
1752 KB |
Output is correct |
6 |
Correct |
2 ms |
1752 KB |
Output is correct |
7 |
Correct |
2 ms |
1760 KB |
Output is correct |
8 |
Correct |
2 ms |
1760 KB |
Output is correct |
9 |
Correct |
2 ms |
1768 KB |
Output is correct |
10 |
Correct |
2 ms |
1768 KB |
Output is correct |
11 |
Correct |
2 ms |
1776 KB |
Output is correct |
12 |
Correct |
2 ms |
1776 KB |
Output is correct |
13 |
Correct |
2 ms |
1784 KB |
Output is correct |
14 |
Correct |
2 ms |
1784 KB |
Output is correct |
15 |
Correct |
2 ms |
1792 KB |
Output is correct |
16 |
Correct |
2 ms |
1796 KB |
Output is correct |
17 |
Correct |
2 ms |
1796 KB |
Output is correct |
18 |
Correct |
2 ms |
1804 KB |
Output is correct |
19 |
Correct |
2 ms |
1804 KB |
Output is correct |
20 |
Correct |
2 ms |
1812 KB |
Output is correct |
21 |
Correct |
2 ms |
1812 KB |
Output is correct |
22 |
Correct |
2 ms |
1820 KB |
Output is correct |
23 |
Correct |
2 ms |
1820 KB |
Output is correct |
24 |
Correct |
2 ms |
1828 KB |
Output is correct |
25 |
Correct |
2 ms |
1832 KB |
Output is correct |
26 |
Correct |
2 ms |
1836 KB |
Output is correct |
27 |
Correct |
2 ms |
1840 KB |
Output is correct |
28 |
Correct |
2 ms |
1844 KB |
Output is correct |
29 |
Correct |
2 ms |
1848 KB |
Output is correct |
30 |
Correct |
2 ms |
1852 KB |
Output is correct |
31 |
Correct |
2 ms |
1888 KB |
Output is correct |
32 |
Correct |
2 ms |
1888 KB |
Output is correct |
33 |
Correct |
3 ms |
1888 KB |
Output is correct |
34 |
Correct |
2 ms |
1900 KB |
Output is correct |
35 |
Correct |
3 ms |
1904 KB |
Output is correct |
36 |
Correct |
4 ms |
2028 KB |
Output is correct |
37 |
Correct |
5 ms |
2028 KB |
Output is correct |
38 |
Correct |
5 ms |
2028 KB |
Output is correct |
39 |
Correct |
6 ms |
2028 KB |
Output is correct |
40 |
Correct |
7 ms |
2028 KB |
Output is correct |
41 |
Correct |
6 ms |
2028 KB |
Output is correct |
42 |
Correct |
6 ms |
2028 KB |
Output is correct |
43 |
Correct |
5 ms |
2028 KB |
Output is correct |
44 |
Correct |
11 ms |
2028 KB |
Output is correct |
45 |
Correct |
15 ms |
2028 KB |
Output is correct |
46 |
Correct |
19 ms |
2028 KB |
Output is correct |
47 |
Correct |
18 ms |
2028 KB |
Output is correct |
48 |
Correct |
13 ms |
2028 KB |
Output is correct |
49 |
Correct |
18 ms |
2028 KB |
Output is correct |
50 |
Correct |
18 ms |
2028 KB |
Output is correct |
51 |
Incorrect |
2 ms |
2028 KB |
Output isn't correct |
52 |
Halted |
0 ms |
0 KB |
- |