This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 5;
#define ll long long
ll a[N];
int main () {
// freopen ("input.txt", "r", stdin);
ll n, A, B;
cin >> n >> A >> B;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
ll jogap = 2e18;
for (int i = 0; i < (1 << n); ++i) {
int x = __builtin_popcount(i);
if (x < A or x > B) continue;
ll jog = 0;
ll el = 0, sum = 0;
for (int j = 0; j < n; ++j) {
sum += a[j];
el++;
if (i>>j&1) {
jog |= sum;
sum = el = 0;
}
}
if (!el) {
jogap = min (jogap, jog);
}
}
cout << jogap;
}
# | 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... |