Submission #131290

#TimeUsernameProblemLanguageResultExecution timeMemory
131290mlyean00Bali Sculptures (APIO15_sculpture)C++14
46 / 100
1086 ms34548 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 + 1 >= 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...