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;
typedef long double ld;
ll dp[2005][2005];
ll niz[2005];
const ll INF = 1000000000000000LL;
int main(){
ios_base::sync_with_stdio(false), cin.tie(0);
cout.precision(10);
cout << fixed;
int n, a, b;
cin >> n >> a >> b;
for(int i=1; i<=b; i++) dp[0][i] = INF;
for(int i=1; i<=n; i++){
cin >> niz[i];
for(int j=0; j<=b; j++) dp[i][j] = INF;
ll sum = 0;
for(int j=i; j>=1; j--){
sum += niz[j];
for(int k=1; k<=b; k++) dp[i][k] = min(dp[i][k], dp[j-1][k-1] | sum);
}
}
cout << dp[n][b] << "\n";
return 0;
}
/*
6 1 3
8 1 2 1 5 4
*/
# | 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... |