#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m,k,x,y,z;
ll a,b;
bool dp[105][2005][105];
ll ar[105];
signed main() {
cin >> n >> a >> b;
for (int i = 1; i <= n; i++) cin >> ar[i];
ll mxval = 0;
for (int i = 1; i <= n; i++) mxval = max(mxval,ar[i]);
for (int i = 1; i <= n; i++) ar[i] += ar[i-1];
dp[0][0][0] = 1;
for (int i = 1; i <= n; i++) { //pos
for (int j = 1; j <= n; j--) { //st pos
for (int k = n; k >= 1; k--) { //groups
for (int l = 0; l <= n*mxval; l++) { //total or
if (dp[j-1][l][k-1]) dp[i][l|(ar[i]-ar[j-1])][k] = 1;
}
}
}
}
for (int i = 0; i <= mxval*n; i++) {
for (int j = a; j <= b; j++) {
if (dp[n][i][j]) {
cout << i << "\n";
return 0;
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |