# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152384 | beso123 | Bali Sculptures (APIO15_sculpture) | C++14 | 2 ms | 504 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 int long long
using namespace std;
int n,A,B,pref[2002],a[2002],dp[2002][2002];
main(){
cin>>n>>A>>B;
for(int k=1;k<=n;k++){
cin>>a[k];
pref[k]=a[k]+pref[k-1];
}
for(int k=1;k<=n;k++)
dp[1][k]=pref[k];
int ans=INT_MAX;
for(int k=2;k<=B;k++){
for(int i=1;i<=n-k;i++){
if(k>i)
continue;
int h=dp[k-1][i] | (pref[n]-pref[i]);
dp[k][i]=h;
if(k>=A && k<=B && i==n-k)
ans=min(ans,dp[k][i]);
}
}
cout<<ans;
return 0;
}
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... |