# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131287 | mlyean00 | Bali Sculptures (APIO15_sculpture) | C++14 | 2 ms | 380 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;
using ll = long long;
int main() {
int n, a, b;
cin >> n >> a >> b;
vector<ll> y(n);
for (int i = 0; i < n; ++i) {
cin >> y[i];
}
vector<ll> pref(n + 1, 0);
partial_sum(y.begin(), y.end(), pref.begin() + 1);
vector<set<ll>> v1(n);
v1[0].insert(0);
ll ans = LLONG_MAX;
for (int i = 0; i < b; ++i) {
vector<set<ll>> v2(n);
for (int j = 0; j < n; ++j) {
for (ll val : v1[j]) {
for (int h = j + 1; h < n; ++h) {
v2[h].insert(val | pref[h] - pref[j]);
}
if (i > a) ans = min(ans, val | pref[n] - pref[j]);
}
}
swap(v1, v2);
}
cout << ans << endl;
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... |