# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
452104 | fadi57 | Bali Sculptures (APIO15_sculpture) | C++14 | 24 ms | 588 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
const int mx=2004;
typedef long long ll;
const int mod=1e9+7;
const int MXm=22;
#define F first
#define S second
const int inf=1e9+10;
ll y[mx],pref[mx];
int n,a,b;
ll mask;
int dp[200][100];
int solve(){
memset(dp,0,sizeof(dp));
dp[0][0]=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
ll sum=0;
for(int k=i;k>=1;k--){
sum+=y[k];
dp[i][j]|=(dp[k-1][j-1]&((sum&mask)==0));
}
}
}
int ok=0;
for(int i=a;i<=b;i++){
ok|=dp[n][i];
}
return ok;
}
int main(){
cin>>n>>a>>b;
vector<int>v;
for(int i=1;i<=n;i++){
cin>>y[i];
}
pref[0]=y[0];
for(int i=1;i<n;i++){
pref[i]=y[i]+pref[i-1];
}
ll ans=0;
ll forbiden=0;
for(int i=44;i>=0;i--){
mask|=(1ll<<i);
if(solve()){
}else{
ans+=(1LL<<i);
mask^=(1LL<<i);
}
}
cout<<ans;
}
Compilation message (stderr)
# | 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... |