# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
108060 | autumn_eel | Palembang Bridges (APIO15_bridge) | C++14 | 4 ms | 412 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>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int,int>P;
typedef long long ll;
int n,a,b;
int d[3000];
bool dp[200][200];
void solve1(){
ll ans=0;
for(int i=39;i>=0;i--){
memset(dp,0,sizeof(dp));
dp[0][0]=true;
rep(j,n)rep(k,n){
if(!dp[j][k])continue;
ll sum=0;
for(int t=j;t<n;t++){
sum+=d[t];
if(((sum&~((1LL<<i)-1))|ans)==ans){
dp[t+1][k+1]=true;
}
}
}
bool ok=false;
for(int j=a;j<=b;j++){
if(dp[n][j])ok=true;
}
if(!ok)ans+=(1LL<<i);
}
cout<<ans<<endl;
}
void solve2(){
}
int main(){
cin>>n>>a>>b;
rep(i,n){
scanf("%d",&d[i]);
}
if(n<=100){
solve1();
}
else{
}
}
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... |