#include <bits/stdc++.h>
#define F first
#define S second
#define P push
#define pb push_back
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define W while
#define R return
#define C continue
#define SI size()
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define SF(x) scanf("%Id",&x)
#define SF2(x,y) scanf("%Id%Id",&x,&y)
#define SF3(x,y,z) scanf("%I64d%I64d%I64d",&x,&y,&z)
#define SF4(x,y,z,o) scanf("%I64d%I64d%I64d%I64d",&x,&y,&z,&o)
#define all(v) v.begin(),v.end()
using namespace std;
const long long INF = 1e9;
const long long MOD = 1e9+7;
const int MX=200015;
ll is=0,notis=0;
int n,l,r,bit;
int a[2222];
int dp[102][102];
int DP(int x,int u){
if(u>r)R 0;
if(x==n)R (u>=l);
int &ret=dp[x][u];
if(ret!=-1)R ret;
ret=0;
ll sum=0;
for(int i=x;i<n;i++){
sum+=a[i];
if((sum¬is)==0){ret=max(ret,DP(i+1,u+1));}
}
R ret;
}
int main(){
cin>>n>>l>>r;
for(int i=0;i<n;i++)cin>>a[i];
// is=8;
for(int i=44;i>=0;i--){
notis+=(1LL<<i);
MEM(dp,-1);
if(DP(0,0)==0){
is+=(1LL<<i);
notis-=(1LL<<i);
}
// cout<<is<<endl;
}
cout<<is;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
424 KB |
Output is correct |
4 |
Correct |
2 ms |
496 KB |
Output is correct |
5 |
Correct |
2 ms |
568 KB |
Output is correct |
6 |
Correct |
2 ms |
604 KB |
Output is correct |
7 |
Correct |
2 ms |
604 KB |
Output is correct |
8 |
Correct |
2 ms |
604 KB |
Output is correct |
9 |
Correct |
2 ms |
620 KB |
Output is correct |
10 |
Correct |
2 ms |
720 KB |
Output is correct |
11 |
Correct |
2 ms |
720 KB |
Output is correct |
12 |
Correct |
2 ms |
720 KB |
Output is correct |
13 |
Correct |
3 ms |
720 KB |
Output is correct |
14 |
Correct |
2 ms |
720 KB |
Output is correct |
15 |
Correct |
2 ms |
720 KB |
Output is correct |
16 |
Correct |
2 ms |
720 KB |
Output is correct |
17 |
Correct |
2 ms |
720 KB |
Output is correct |
18 |
Correct |
2 ms |
720 KB |
Output is correct |
19 |
Correct |
2 ms |
720 KB |
Output is correct |
20 |
Correct |
2 ms |
720 KB |
Output is correct |
21 |
Correct |
2 ms |
720 KB |
Output is correct |
22 |
Correct |
2 ms |
720 KB |
Output is correct |
23 |
Correct |
2 ms |
720 KB |
Output is correct |
24 |
Correct |
2 ms |
720 KB |
Output is correct |
25 |
Correct |
2 ms |
720 KB |
Output is correct |
26 |
Correct |
2 ms |
756 KB |
Output is correct |
27 |
Correct |
2 ms |
756 KB |
Output is correct |
28 |
Correct |
2 ms |
756 KB |
Output is correct |
29 |
Correct |
2 ms |
756 KB |
Output is correct |
30 |
Correct |
2 ms |
756 KB |
Output is correct |
31 |
Correct |
2 ms |
756 KB |
Output is correct |
32 |
Correct |
2 ms |
756 KB |
Output is correct |
33 |
Correct |
2 ms |
756 KB |
Output is correct |
34 |
Correct |
2 ms |
756 KB |
Output is correct |
35 |
Correct |
2 ms |
756 KB |
Output is correct |
36 |
Correct |
2 ms |
756 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
756 KB |
Output is correct |
2 |
Correct |
2 ms |
756 KB |
Output is correct |
3 |
Correct |
2 ms |
756 KB |
Output is correct |
4 |
Correct |
2 ms |
756 KB |
Output is correct |
5 |
Correct |
2 ms |
756 KB |
Output is correct |
6 |
Correct |
2 ms |
756 KB |
Output is correct |
7 |
Correct |
2 ms |
756 KB |
Output is correct |
8 |
Correct |
2 ms |
756 KB |
Output is correct |
9 |
Correct |
2 ms |
804 KB |
Output is correct |
10 |
Correct |
2 ms |
804 KB |
Output is correct |
11 |
Correct |
2 ms |
804 KB |
Output is correct |
12 |
Correct |
2 ms |
804 KB |
Output is correct |
13 |
Correct |
2 ms |
804 KB |
Output is correct |
14 |
Correct |
2 ms |
804 KB |
Output is correct |
15 |
Correct |
2 ms |
804 KB |
Output is correct |
16 |
Correct |
2 ms |
804 KB |
Output is correct |
17 |
Correct |
2 ms |
804 KB |
Output is correct |
18 |
Correct |
2 ms |
804 KB |
Output is correct |
19 |
Correct |
2 ms |
804 KB |
Output is correct |
20 |
Correct |
2 ms |
804 KB |
Output is correct |
21 |
Correct |
2 ms |
804 KB |
Output is correct |
22 |
Correct |
2 ms |
804 KB |
Output is correct |
23 |
Correct |
2 ms |
804 KB |
Output is correct |
24 |
Correct |
2 ms |
804 KB |
Output is correct |
25 |
Correct |
2 ms |
804 KB |
Output is correct |
26 |
Correct |
2 ms |
804 KB |
Output is correct |
27 |
Correct |
2 ms |
804 KB |
Output is correct |
28 |
Correct |
3 ms |
804 KB |
Output is correct |
29 |
Correct |
3 ms |
804 KB |
Output is correct |
30 |
Correct |
4 ms |
804 KB |
Output is correct |
31 |
Correct |
6 ms |
804 KB |
Output is correct |
32 |
Correct |
6 ms |
804 KB |
Output is correct |
33 |
Correct |
2 ms |
804 KB |
Output is correct |
34 |
Correct |
6 ms |
804 KB |
Output is correct |
35 |
Correct |
6 ms |
804 KB |
Output is correct |
36 |
Correct |
4 ms |
804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
804 KB |
Output is correct |
2 |
Correct |
2 ms |
804 KB |
Output is correct |
3 |
Correct |
2 ms |
804 KB |
Output is correct |
4 |
Correct |
2 ms |
804 KB |
Output is correct |
5 |
Correct |
2 ms |
804 KB |
Output is correct |
6 |
Correct |
2 ms |
804 KB |
Output is correct |
7 |
Correct |
3 ms |
804 KB |
Output is correct |
8 |
Correct |
2 ms |
804 KB |
Output is correct |
9 |
Correct |
2 ms |
804 KB |
Output is correct |
10 |
Correct |
2 ms |
804 KB |
Output is correct |
11 |
Correct |
2 ms |
804 KB |
Output is correct |
12 |
Correct |
2 ms |
804 KB |
Output is correct |
13 |
Correct |
2 ms |
804 KB |
Output is correct |
14 |
Correct |
2 ms |
804 KB |
Output is correct |
15 |
Correct |
2 ms |
804 KB |
Output is correct |
16 |
Correct |
2 ms |
804 KB |
Output is correct |
17 |
Correct |
5 ms |
804 KB |
Output is correct |
18 |
Correct |
6 ms |
804 KB |
Output is correct |
19 |
Correct |
5 ms |
804 KB |
Output is correct |
20 |
Correct |
2 ms |
804 KB |
Output is correct |
21 |
Correct |
6 ms |
804 KB |
Output is correct |
22 |
Correct |
5 ms |
804 KB |
Output is correct |
23 |
Correct |
4 ms |
804 KB |
Output is correct |
24 |
Correct |
5 ms |
804 KB |
Output is correct |
25 |
Correct |
8 ms |
804 KB |
Output is correct |
26 |
Correct |
12 ms |
804 KB |
Output is correct |
27 |
Correct |
27 ms |
804 KB |
Output is correct |
28 |
Correct |
39 ms |
912 KB |
Output is correct |
29 |
Correct |
37 ms |
912 KB |
Output is correct |
30 |
Correct |
2 ms |
912 KB |
Output is correct |
31 |
Correct |
36 ms |
912 KB |
Output is correct |
32 |
Correct |
37 ms |
912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
912 KB |
Output is correct |
2 |
Correct |
2 ms |
912 KB |
Output is correct |
3 |
Correct |
2 ms |
912 KB |
Output is correct |
4 |
Correct |
2 ms |
912 KB |
Output is correct |
5 |
Correct |
1 ms |
912 KB |
Output is correct |
6 |
Correct |
2 ms |
912 KB |
Output is correct |
7 |
Correct |
2 ms |
912 KB |
Output is correct |
8 |
Correct |
2 ms |
912 KB |
Output is correct |
9 |
Correct |
2 ms |
912 KB |
Output is correct |
10 |
Correct |
1 ms |
912 KB |
Output is correct |
11 |
Correct |
1 ms |
912 KB |
Output is correct |
12 |
Correct |
2 ms |
912 KB |
Output is correct |
13 |
Correct |
2 ms |
912 KB |
Output is correct |
14 |
Correct |
1 ms |
912 KB |
Output is correct |
15 |
Correct |
1 ms |
912 KB |
Output is correct |
16 |
Correct |
1 ms |
912 KB |
Output is correct |
17 |
Correct |
1 ms |
912 KB |
Output is correct |
18 |
Correct |
1 ms |
912 KB |
Output is correct |
19 |
Correct |
2 ms |
912 KB |
Output is correct |
20 |
Correct |
2 ms |
912 KB |
Output is correct |
21 |
Correct |
2 ms |
912 KB |
Output is correct |
22 |
Correct |
2 ms |
912 KB |
Output is correct |
23 |
Correct |
2 ms |
912 KB |
Output is correct |
24 |
Correct |
2 ms |
912 KB |
Output is correct |
25 |
Correct |
2 ms |
912 KB |
Output is correct |
26 |
Correct |
2 ms |
912 KB |
Output is correct |
27 |
Correct |
2 ms |
912 KB |
Output is correct |
28 |
Correct |
1 ms |
912 KB |
Output is correct |
29 |
Correct |
2 ms |
912 KB |
Output is correct |
30 |
Correct |
2 ms |
912 KB |
Output is correct |
31 |
Correct |
2 ms |
912 KB |
Output is correct |
32 |
Correct |
1 ms |
912 KB |
Output is correct |
33 |
Correct |
2 ms |
912 KB |
Output is correct |
34 |
Correct |
2 ms |
912 KB |
Output is correct |
35 |
Correct |
2 ms |
912 KB |
Output is correct |
36 |
Correct |
2 ms |
912 KB |
Output is correct |
37 |
Correct |
2 ms |
912 KB |
Output is correct |
38 |
Correct |
2 ms |
912 KB |
Output is correct |
39 |
Correct |
2 ms |
912 KB |
Output is correct |
40 |
Correct |
5 ms |
912 KB |
Output is correct |
41 |
Correct |
6 ms |
912 KB |
Output is correct |
42 |
Correct |
5 ms |
968 KB |
Output is correct |
43 |
Correct |
2 ms |
968 KB |
Output is correct |
44 |
Correct |
6 ms |
968 KB |
Output is correct |
45 |
Correct |
5 ms |
968 KB |
Output is correct |
46 |
Correct |
4 ms |
968 KB |
Output is correct |
47 |
Correct |
5 ms |
968 KB |
Output is correct |
48 |
Correct |
6 ms |
968 KB |
Output is correct |
49 |
Correct |
13 ms |
968 KB |
Output is correct |
50 |
Correct |
27 ms |
968 KB |
Output is correct |
51 |
Correct |
37 ms |
968 KB |
Output is correct |
52 |
Correct |
38 ms |
968 KB |
Output is correct |
53 |
Correct |
2 ms |
968 KB |
Output is correct |
54 |
Correct |
32 ms |
968 KB |
Output is correct |
55 |
Correct |
38 ms |
1056 KB |
Output is correct |
56 |
Correct |
3 ms |
1056 KB |
Output is correct |
57 |
Correct |
8 ms |
1056 KB |
Output is correct |
58 |
Correct |
10 ms |
1056 KB |
Output is correct |
59 |
Correct |
13 ms |
1056 KB |
Output is correct |
60 |
Correct |
16 ms |
1056 KB |
Output is correct |
61 |
Correct |
2 ms |
1056 KB |
Output is correct |
62 |
Correct |
22 ms |
1084 KB |
Output is correct |
63 |
Correct |
25 ms |
1084 KB |
Output is correct |
64 |
Correct |
31 ms |
1084 KB |
Output is correct |
65 |
Correct |
4 ms |
1084 KB |
Output is correct |
66 |
Correct |
4 ms |
1084 KB |
Output is correct |
67 |
Correct |
5 ms |
1084 KB |
Output is correct |
68 |
Correct |
13 ms |
1084 KB |
Output is correct |
69 |
Correct |
13 ms |
1084 KB |
Output is correct |
70 |
Correct |
12 ms |
1084 KB |
Output is correct |
71 |
Correct |
2 ms |
1084 KB |
Output is correct |
72 |
Correct |
16 ms |
1084 KB |
Output is correct |
73 |
Correct |
16 ms |
1088 KB |
Output is correct |
74 |
Correct |
15 ms |
1088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1088 KB |
Output is correct |
2 |
Correct |
1 ms |
1088 KB |
Output is correct |
3 |
Correct |
1 ms |
1088 KB |
Output is correct |
4 |
Correct |
1 ms |
1088 KB |
Output is correct |
5 |
Correct |
1 ms |
1088 KB |
Output is correct |
6 |
Correct |
2 ms |
1088 KB |
Output is correct |
7 |
Correct |
1 ms |
1088 KB |
Output is correct |
8 |
Correct |
2 ms |
1088 KB |
Output is correct |
9 |
Correct |
2 ms |
1088 KB |
Output is correct |
10 |
Correct |
2 ms |
1088 KB |
Output is correct |
11 |
Correct |
1 ms |
1088 KB |
Output is correct |
12 |
Correct |
2 ms |
1088 KB |
Output is correct |
13 |
Correct |
2 ms |
1088 KB |
Output is correct |
14 |
Correct |
1 ms |
1108 KB |
Output is correct |
15 |
Correct |
1 ms |
1108 KB |
Output is correct |
16 |
Correct |
2 ms |
1108 KB |
Output is correct |
17 |
Correct |
2 ms |
1108 KB |
Output is correct |
18 |
Correct |
2 ms |
1108 KB |
Output is correct |
19 |
Correct |
1 ms |
1108 KB |
Output is correct |
20 |
Correct |
2 ms |
1108 KB |
Output is correct |
21 |
Correct |
2 ms |
1108 KB |
Output is correct |
22 |
Correct |
2 ms |
1108 KB |
Output is correct |
23 |
Correct |
2 ms |
1108 KB |
Output is correct |
24 |
Correct |
2 ms |
1108 KB |
Output is correct |
25 |
Correct |
2 ms |
1108 KB |
Output is correct |
26 |
Correct |
2 ms |
1108 KB |
Output is correct |
27 |
Correct |
6 ms |
1108 KB |
Output is correct |
28 |
Correct |
7 ms |
1108 KB |
Output is correct |
29 |
Correct |
5 ms |
1108 KB |
Output is correct |
30 |
Correct |
2 ms |
1108 KB |
Output is correct |
31 |
Correct |
5 ms |
1108 KB |
Output is correct |
32 |
Correct |
5 ms |
1108 KB |
Output is correct |
33 |
Correct |
4 ms |
1108 KB |
Output is correct |
34 |
Correct |
5 ms |
1108 KB |
Output is correct |
35 |
Correct |
5 ms |
1108 KB |
Output is correct |
36 |
Correct |
12 ms |
1108 KB |
Output is correct |
37 |
Correct |
31 ms |
1140 KB |
Output is correct |
38 |
Correct |
37 ms |
1140 KB |
Output is correct |
39 |
Correct |
36 ms |
1140 KB |
Output is correct |
40 |
Correct |
2 ms |
1140 KB |
Output is correct |
41 |
Correct |
32 ms |
1140 KB |
Output is correct |
42 |
Correct |
36 ms |
1140 KB |
Output is correct |
43 |
Correct |
3 ms |
1140 KB |
Output is correct |
44 |
Correct |
6 ms |
1140 KB |
Output is correct |
45 |
Correct |
16 ms |
1140 KB |
Output is correct |
46 |
Correct |
13 ms |
1140 KB |
Output is correct |
47 |
Correct |
13 ms |
1140 KB |
Output is correct |
48 |
Correct |
2 ms |
1140 KB |
Output is correct |
49 |
Correct |
16 ms |
1140 KB |
Output is correct |
50 |
Correct |
16 ms |
1140 KB |
Output is correct |
51 |
Correct |
7 ms |
1140 KB |
Output is correct |
52 |
Runtime error |
2 ms |
1140 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
53 |
Halted |
0 ms |
0 KB |
- |