#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf=(1e9)+10;
int main(){
ll n, a, b, i, j, h;
cin>>n>>a>>b;
vector<ll> v(n+1, 0);
for(i=1; i<=n; i++){
cin>>v[i];
}
vector<vector<ll>> dp(n+1, vector<ll>(b+1, inf));
vector<ll> pre(n+1, 0);
for(i=1; i<=n; i++){
pre[i]=pre[i-1]+v[i];
}
for(i=1; i<=n; i++){
dp[i][1]=pre[i];
}
for(i=1; i<=n; i++){
for(j=2; j<=b; j++){
for(h=1; h<i; h++){
if(dp[h][j-1]<inf && dp[i][j]>(dp[h][j-1] | (pre[i]-pre[h]))){
dp[i][j]=(dp[h][j-1] | (pre[i]-pre[h]));
}
}
}
}
ll mn=inf;
for(i=1; i<=b; i++){
mn=min(mn, dp[n][i]);
}
cout<<mn;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |