#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int cimbom, gs, gala;
cin >> cimbom >> gs >> gala;
vector<long long> Y(cimbom + 1);
vector<long long> pref(cimbom + 1);
for (int i = 1; i <= cimbom; ++i) {
cin >> Y[i];
pref[i] = pref[i - 1] + Y[i];
}
int ans = INT_MAX;
for (int groups = gs; groups <= gala; ++groups) {
vector<vector<int>> dp(cimbom + 1, vector<int>(groups + 1, INT_MAX / 2));
dp[0][0] = 0;
for (int i = 1; i <= cimbom; ++i) {
for (int g = 1; g <= min(groups, i); ++g) {
for (int j = 0; j < i; ++j) {
long long sum = pref[i] - pref[j];
if (dp[j][g - 1] != INT_MAX / 2) {
int new_or = dp[j][g - 1] | (int)sum;
dp[i][g] = min(dp[i][g], new_or);
}
}
}
}
ans = min(ans, dp[cimbom][groups]);
}
cout << ans << '\n';
return 0;
}
| # | 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... |