#include <bits/stdc++.h>
using namespace std;
int n,a,b,arr[59];
int dp[59][509][70][25][2];
int bt(int id,int sum,int curr,int flag,bool flag2){
if(id == n){
if(flag < a || flag > b || !flag2) return 1000000009;
return curr;
}
int &ret = dp[id][sum][curr][flag][flag2];
if(ret != -1) return ret;
ret = 1000000009;
sum += arr[id];
ret = min(ret,bt(id+1,sum,curr,flag,0));
curr |= sum;
ret = min(ret,bt(id+1,0,curr,flag+1,1));
return ret;
}
int main(){
cin>>n>>a>>b;
for(int i=0;i<n;i++) cin>>arr[i];
memset(dp,-1,sizeof(dp));
cout<<bt(0,0,0,0,0)<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
418 ms |
263168 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
192 ms |
263168 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
203 ms |
263168 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
231 ms |
263168 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
203 ms |
263168 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |