Submission #131287

#TimeUsernameProblemLanguageResultExecution timeMemory
131287mlyean00Bali Sculptures (APIO15_sculpture)C++14
0 / 100
2 ms380 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; }

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:26:48: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
                     v2[h].insert(val | pref[h] - pref[j]);
sculpture.cpp:28:57: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
                 if (i > a) ans = min(ans, val | pref[n] - pref[j]);
#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...