# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31402 | houtaru | Bali Sculptures (APIO15_sculpture) | C++14 | 0 ms | 2032 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;
const int N = 2222;
int n, a, b;
long long answer = 1e18;
long long y[N];
void load() {
scanf("%d%d%d", &n, &a, &b);
for (int i = 1; i <= n; ++i) {
scanf("%d", y + i);
y[i] += y[i - 1];
}
}
void calc(int pre, int gr, long long sum) {
if (gr == 1) {
answer = min(answer, sum | (y[n] - y[pre]));
return;
}
for (int i = pre + 1; i <= n - gr; ++i) {
calc(i, gr - 1, sum | (y[i] - y[pre]));
}
}
void process() {
for (int x = a; x <= b; ++x)
calc(0, x, 0);
printf("%lld\n", answer);
}
int main() {
// freopen("input.in", "r", stdin);
// freopen("output.out", "w", stdout);
load();
process();
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... |