#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define MAX 100
#define MAXM
lli n, a, b, y[MAX + 3], dp[MAX + 3][MAX + 3], msk;
int main(){
cin >> n >> a >> b;
rep(i, 1, n){
cin >> y[i];
}
msk = 0;
for(int bit = 36; bit >= 0; --bit){
lli acu = 0;
rep(i, 1, n){
acu += y[i];
if(!(acu & (1ll << bit)) && !(acu & msk)) dp[1][i] = 1;
else dp[1][i] = 0;
}
rep(fil, 2, b){
rep(col, fil, n){
lli suma = y[col];
dp[fil][col] = 0;
for(int i = col - 1; i >= fil - 1; --i){
if(!(suma & (1ll << bit)) && !(suma & msk) && dp[fil - 1][i]){
dp[fil][col] = 1;
break;
}
suma += y[i];
}
}
if(fil >= a && dp[fil][n]){
msk |= (1ll << bit);
break;
}
}
}
msk ^= 0x1FFFFFFFFF;
cout << msk;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |