# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31402 | 2017-08-21T07:27:18 Z | houtaru | Bali Sculptures (APIO15_sculpture) | C++14 | 0 ms | 2032 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2032 KB | Output is correct |
2 | Incorrect | 0 ms | 2032 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2032 KB | Output is correct |
2 | Incorrect | 0 ms | 2032 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2032 KB | Output is correct |
2 | Incorrect | 0 ms | 2032 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2032 KB | Output is correct |
2 | Incorrect | 0 ms | 2032 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2032 KB | Output is correct |
2 | Incorrect | 0 ms | 2032 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |