#include <bits/stdc++.h>
using namespace std;
#define int long long
const int NM = 2000, LIM = 100;
namespace subtask4{
int N, A, B, Y[LIM+5], pref[LIM+5];
bool dp[LIM+5][LIM+5];
void solve(int _N, int _A, int _B){
N = _N, A = _A, B = _B;
for (int i = 1; i <= N; i++){
cin >> Y[i];
pref[i] = pref[i-1]+Y[i];
}
int msk = 0;
for (int t = 36; t >= 0; t--){
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
for (int i = 0; i < N; i++)
for (int k = i+1; k <= N; k++){
if ((pref[k]-pref[i])&(msk+(1LL<<t))) continue;
for (int j = 0; j <= i; j++) dp[k][j+1] |= dp[i][j];
}
for (int i = A; i <= B; i++)
if (dp[N][i]){
msk += 1LL<<t;
break;
}
}
cout << (1LL<<37)-1-msk;
}
}
int N, A, B;
signed main(){
// freopen("sculpture.inp", "r", stdin);
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N >> A >> B;
if (N <= 100) subtask4::solve(N, A, B);
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... |