#include
using namespace std;
typedef long long dint; #ifdef WIN32 #define lld “%I64d” #else #define lld “%lld” #endif #define _l (long long int) #define lpow2(x) (1ll«(x))
const int maxn = 2009; const int maxb = 43;
dint a[maxn], ans;
int n, ml, mh, d[maxn];
bitset
int bitDP(int bo) { if (ml > 1) { memset(f, 0, sizeof(f)); f[0][0] = 1; for (int i = 1; i <= n; ++ i) { f[i - 1] «= 1; for (int j = 0; j < i; ++ j) { dint vd(a[i] - a[j]); if (((vd & ans) » bo) != (vd » bo)) continue; f[i] |= f[j]; } } for (int i = ml; i <= mh; ++ i) if (f[n][i]) return 0; return 1; } else { memset(d, 0x3f, sizeof(d)); d[0] = 0; for (int i = 1; i <= n; ++ i) { for (int j = 0; j < i; ++ j) { dint vd(a[i] - a[j]); if (((vd & ans) » bo) != (vd » bo)) continue; d[i] = min(d[i], d[j] + 1); } } return !(d[n] <= mh); } }
int main() { scanf("%d%d%d", &n, &ml, &mh); a[0] = 0; for (int i = 1; i <= n; ++ i) { scanf(lld, a + i); a[i] += a[i - 1]; } ans = 0; for (int i = maxb; i >= 0; – i) if (bitDP(i)) ans |= lpow2(i); printf(lld “\n”, ans); }