# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
498997 | amukkalir | Bali Sculptures (APIO15_sculpture) | C++17 | 1089 ms | 332 KiB |
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;
typedef long long ll;
const ll INF = 1e15;
const int nax = 2000;
int a, b, n;
int y[nax+5];
ll f(int idx, ll sum, ll val, int grup) {
if(idx==n) return (a <= grup && grup <= b) ? (val | (sum + y[n])) : INF;
return min(f(idx+1, sum+y[idx], val, grup), f(idx+1, 0, val | (sum+y[idx]), grup+1));
}
int main() {
scanf("%d %d %d", &n, &a, &b);
for(int i=1; i<=n; i++) {
scanf("%d", &y[i]);
}
printf("%lld", f(1, 0, 0, 1));
}
Compilation message (stderr)
# | 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... |