// 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 |
1 |
Correct |
21 ms |
35148 KB |
Output is correct |
2 |
Incorrect |
19 ms |
35112 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
35156 KB |
Output is correct |
2 |
Incorrect |
19 ms |
35148 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
35164 KB |
Output is correct |
2 |
Incorrect |
19 ms |
35148 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
35148 KB |
Output is correct |
2 |
Incorrect |
19 ms |
35148 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
35080 KB |
Output is correct |
2 |
Incorrect |
20 ms |
35148 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |