This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Muallif: Azimjon Mehmonali o'g'li
#include <bits/stdc++.h>
using namespace std;
#define int long long
const long double PI = 3.1415926535897;
const int mod = 1000000007LL;
const int INF = 1e18;
const int N = 2111;
const int K = 2111;
int n, k;
int y[N], p[N], dp[K][N], pa[K][N];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, a, b;
cin >> n >> a >> b;
for (int i = 1; i <= n; i++) {
cin >> y[i];
p[i] = p[i - 1] + y[i];
}
for (int i = 1; i < N; i++) {
for (int j = 0; j < N; j++) {
dp[i][j] = INF;
}
}
for (int i = 1; i <= n; i++)
dp[0][i] = p[i];
for (int k = 1; k < n; k++) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j < i; j++) {
dp[k][i] = min(dp[k][i], dp[k - 1][j] | ((p[i] - p[j])));
}
}
}
int jv = INF;
for (int i = a - 1; i < b; i++) {
jv = min(jv, dp[i][n]);
}
cout << jv << endl;
return 0;
}
# | 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... |