#include <bits/stdc++.h>
#define int long long
using namespace std;
int ret;
int n,a,b;
int y[2005];
int f[2005][2005];
signed main(){
ios_base::sync_with_stdio(false),cin.tie(0);
//freopen("SCULPTURES.inp","r",stdin);
cin>>n>>a>>b;
for(int i=1;i<=n;++i) cin>>y[i];
for(int i=3;i>=0;--i){
memset(f,0,sizeof (f));
f[1][1]=1;
for(int j=1;j<=n;++j){
for(int k=1;k<=b;++k) if(f[j][k]) {
int cur=0;
for(int t=j;t<=n;++t){
cur+=y[t];
if(((cur>>(i+1))|ret)==ret && !((cur>>i)&1)){
f[t+1][k+1]=1;
}
}
}
}
ret<<=1;
int ok=0;
for(int j=a;j<=b;++j) ok=ok||f[n+1][j+1];
ret+=!ok;
}
cout<<ret<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
31768 KB |
Output is correct |
2 |
Correct |
51 ms |
31872 KB |
Output is correct |
3 |
Correct |
49 ms |
31744 KB |
Output is correct |
4 |
Correct |
53 ms |
31832 KB |
Output is correct |
5 |
Incorrect |
50 ms |
31948 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
31816 KB |
Output is correct |
2 |
Correct |
53 ms |
31864 KB |
Output is correct |
3 |
Correct |
50 ms |
31872 KB |
Output is correct |
4 |
Correct |
47 ms |
31744 KB |
Output is correct |
5 |
Incorrect |
57 ms |
31744 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
31744 KB |
Output is correct |
2 |
Correct |
49 ms |
31864 KB |
Output is correct |
3 |
Correct |
52 ms |
31864 KB |
Output is correct |
4 |
Correct |
49 ms |
31864 KB |
Output is correct |
5 |
Incorrect |
51 ms |
31736 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
31744 KB |
Output is correct |
2 |
Correct |
49 ms |
31852 KB |
Output is correct |
3 |
Correct |
51 ms |
31864 KB |
Output is correct |
4 |
Correct |
49 ms |
31864 KB |
Output is correct |
5 |
Incorrect |
48 ms |
31864 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
31872 KB |
Output is correct |
2 |
Correct |
56 ms |
31764 KB |
Output is correct |
3 |
Correct |
58 ms |
31864 KB |
Output is correct |
4 |
Correct |
49 ms |
31864 KB |
Output is correct |
5 |
Incorrect |
51 ms |
31848 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |