#include <bits/stdc++.h>
using namespace std;
#define name "sculptures"
#define MAXN 100005
#define pb push_back
#define pf push_front
#define ll long long
#define ii pair<int, int>
#define fs first
#define sc second
#define ill pair<int, ll>
#define lli pair<ll, int>
#define llll pair<ll, ll>
#define all(v) v.begin(),v.end()
#define uni(v) v.erase(unique(all(v)),v.end())
#define bit(n,i) (((n)>>(i))&1)
#define FOR(i,a,b) for (int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for (int i=(a),_b=(b); i>=_b; i--)
#define MASK(i) (1LL<<(i))
const int INF=1e9;
const int MOD=1e9+7;
void add(int &u, int v){
u+=v;
if (u>=MOD) u-=MOD;
}
void sub(int &u, int v){
u-=v;
if (u<0) u+=MOD;
}
void minimize(int &u, int v){
u=min(u,v);
}
void maximize(int &u, int v){
u=max(u,v);
}
long long Rand(long long l, long long r){
ll tmp=0;
FOR(i,1,4) tmp=((tmp<<15)^(((1<<15)-1)&rand()));
return l+tmp%(r-l+1);
}
int n,x,y;
int a[MAXN];
ll sum[MAXN];
ll get(int u, int v){
return sum[v]-sum[u-1];
}
namespace sub4{
bool dp[102][102];
void solve(){
ll cur=0;
FORD(c,35,0){
cur|=MASK(c);
dp[0][0]=1;
FOR(g,1,y){
FOR(i,g,n){
dp[g][i]=0;
FOR(j,g-1,i-1){
if (dp[g-1][j]&&(cur&get(j+1,i))==0) dp[g][i]=1;
}
}
}
bool ok=0;
FOR(g,x,y) if (dp[g][n]){
ok=1;
break;
}
if (!ok) cur^=MASK(c);
}
cout<<MASK(36)-1-cur;
}
}
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin>>n>>x>>y;
FOR(i,1,n) cin>>a[i];
FOR(i,1,n) sum[i]=sum[i-1]+1LL*a[i];
if (n<=100) sub4::solve();
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... |