# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
227577 | tushar_2658 | Bali Sculptures (APIO15_sculpture) | C++14 | 5 ms | 384 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 maxn = 105;
using ll = long long;
ll dp[maxn][maxn];
ll a[maxn];
int main(int argc, char const *argv[])
{
// freopen("in.txt", "r", stdin);
int n, A, B;
scanf("%d %d %d", &n, &A, &B);
for(int i = 1; i <= n; ++i){
scanf("%lld", &a[i]);
}
vector<ll> p(n + 1);
for(int i = 1; i <= n; ++i){
p[i] = p[i - 1] + a[i];
}
memset(dp, 63, sizeof dp);
dp[0][0] = 0;
for(int k = 1; k <= B; ++k){
for(int i = 1; i <= n; ++i){
for(int j = 0; j < i; ++j){
dp[i][k] = min(dp[i][k], dp[j][k - 1] | (p[i] - p[j]));
}
}
}
ll ans = LLONG_MAX;
for(int i = A; i <= B; ++i){
ans = min(ans, dp[n][i]);
}
cout << ans << endl;
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... |