# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
455335 | qwerasdfzxcl | Bali Sculptures (APIO15_sculpture) | C++14 | 13 ms | 4300 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>
typedef long long ll;
using namespace std;
int a[2020];
bool dp[2020][2020];
int main(){
int n, l, r;
scanf("%d %d %d", &n, &l, &r);
for (int i=1;i<=n;i++) scanf("%d", a+i);
ll cur = 0, ans = 0;
for (int i=60;i>=0;i--){
fill(dp[0], dp[2019]+2020, 0);
cur |= 1LL<<i;
ll cur2 = 0;
for (int j=1;j<=n;j++){
cur2 += a[j];
if ((cur2&cur)==ans) dp[j][1] = 1;
for (int k=2;k<=j;k++){
ll cur3 = 0;
for (int l=j;l>k-1;l--){
cur3 += a[l];
if (dp[l-1][k-1] && (cur3&cur)==ans) dp[j][k] = 1;
}
}
}
bool flag = 1;
for (int j=l;j<=r;j++) if (dp[n][j]) flag = 0;
if (flag) ans |= 1LL<<i;
}
printf("%lld\n", 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... |