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;
#define MAXN 2003
typedef long long lld;
int N, A, B;
int X[MAXN];
lld D[MAXN][MAXN];
int main()
{
scanf("%d%d%d", &N, &A, &B);
for (int i=1;i<=N;i++) scanf("%d", X+i);
for (int i=1;i<=N;i++) D[1][i] = D[1][i-1] + X[i];
for (int i=2;i<=B;i++){
for (int j=i;j<=N;j++){
D[i][j] = 1e18;
for (int k=j-1;k>=i-1;k--){
D[i][j] = min(D[i][j], D[i-1][k] | (D[1][j] - D[1][k]));
}
}
}
lld ans = 1e18;
for (int i=A;i<=B;i++) ans = min(ans, D[i][N]);
printf("%lld\n", ans);
}
# | 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... |