#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> pref(cimbom + 1);
for (int i = 1; i <= cimbom; ++i) { long long x; cin >> x; pref[i] = pref[i - 1] + x;
}
int cevap = INT_MAX;
for (int grup = gs; grup <= gala; ++grup) { vector<vector<int>> dp(cimbom + 1, vector<int>(grup + 1, INT_MAX / 2)); dp[0][0] = 0;
for (int i = 1; i <= cimbom; ++i) {
for (int k = 1; k <= min(grup, i); ++k) {
for (int j = 0; j < i; ++j) {
if (dp[j][k - 1] == INT_MAX / 2) continue;
long long toplam = pref[i] - pref[j];
int yeni = dp[j][k - 1] | (int)toplam;
if (yeni < dp[i][k]) {
dp[i][k] = yeni;
}
}
}
} if (dp[cimbom][grup] < INT_MAX / 2) { cevap = min(cevap, dp[cimbom][grup]);
}
} cout << cevap << '\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... |