#include <bits/stdc++.h>
using namespace std;
bitset<2001> posibil[2001];
long long sir[2001];
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int cimbom, gs, gala;
cin >> cimbom >> gs >> gala;
for (int i = 1; i <= cimbom; i++) {
cin >> sir[i];
}
long long cevap = (1LL << 45) - 1;
for (long long bit = 1LL << 44; bit; bit >>= 1) {
cevap ^= bit;
posibil[0][0] = 1;
for (int i = 1; i <= cimbom; i++) posibil[i].reset();
for (int r = 1; r <= cimbom; r++) {
long long s = 0;
for (int l = r; l >= 1; l--) {
s += sir[l];
if (s > cevap) break;
if ((s & cevap) == s) {
posibil[r] |= (posibil[l - 1] << 1);
}
}
}
bool var = false;
for (int k = gs; k <= gala; k++) {
if (posibil[cimbom][k]) {
var = true;
break;
}
}
if (!var) {
cevap |= bit;
}
}
cout << cevap << '\n';
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |