#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define vi vector < int >
#define vl vector < ll >
#define pi pair < int, int >
#define pii pair < int, pi >
#define vii vector < pi >
const int N = 107;
const int INF = 1e9 + 7;
int c[N], pr[N], dp[N][N];
int n, a, b;
main(){
cin >> n >> a >> b;
for (int i = 1; i <= n; i++){
cin >> c[i];
pr[i] = c[i] + pr[i - 1];
fill(dp[i], dp[i] + N, INF);
}
for (int i = 1; i <= n; i++){
for (int j = 1; j <= min(i, b); j++){
if (j > 1){
for (int k = j; k <= i; k++){
dp[i][j] = min(dp[i][j], (dp[k - 1][j - 1] | (pr[i] - pr[k - 1])));
}
}
else
dp[i][j] = pr[i];
}
}
int mn = INF;
for (int i = a; i <= b; i++){
mn = min(mn, dp[n][i]);
}
cout << mn;
}
Compilation message
sculpture.cpp:21:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(){
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Incorrect |
3 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
432 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
3 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |