Submission #131289

#TimeUsernameProblemLanguageResultExecution timeMemory
131289mlyean00Bali Sculptures (APIO15_sculpture)C++14
0 / 100
2 ms376 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...