# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
33722 | sinhriv | Bali Sculptures (APIO15_sculpture) | C++14 | 0 ms | 33916 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;
const int N = 2020;
int n, a, b;
int arr[N];
long long sum[N];
long long f[N][N];
int main(){
if(fopen("1.inp", "r")){
freopen("1.inp", "r", stdin);
}
cin >> n >> a >> b;
for(int i = 1; i <= n; ++i){
cin >> arr[i];
sum[i] = arr[i] + sum[i - 1];
f[i][1] = sum[i];
}
for(int i = 2; i <= n; ++i){
for(int j = 2; j <= i; ++j){
f[i][j] = sum[i];
for(int k = i - 1; k >= j - 1; --k){
f[i][j] = min(f[i][j], f[k][j - 1] | (sum[i] - sum[k]));
}
}
}
long long ans = sum[n];
for(int i = a; i <= b; ++i){
ans = min(ans, f[n][i]);
}
cout << ans;
return 0;
}
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... |