# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
609553 | Plurm | Bali Sculptures (APIO15_sculpture) | C++11 | 466 ms | 4428 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>
using namespace std;
int y[2048];
int dp[2048];
bool check[2048][2048];
int main() {
int n, a, b;
scanf("%d%d%d", &n, &a, &b);
for (int i = 1; i <= n; i++) {
scanf("%d", y + i);
}
long long oldmask = 0ll;
for (long long bit = 60; bit >= 0; bit--) {
long long mask = oldmask | ((1ll << bit) - 1ll);
for (int i = 1; i <= n; i++) {
long long sum = 0ll;
for (int j = i; j <= n; j++) {
sum += y[j];
check[i][j] = (sum | mask) == mask;
}
}
for (int i = 1; i <= n; i++) {
if (check[1][i])
dp[i] = 1;
else
dp[i] = 1e9;
for (int j = 1; j < i; j++) {
if (check[j + 1][i]) {
dp[i] = min(dp[j] + 1, dp[i]);
}
}
}
if (dp[n] > b) {
oldmask |= 1ll << bit;
}
}
printf("%lld\n", oldmask);
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... |