답안 #110284

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
110284 2019-05-10T13:12:54 Z tc_abd Bali Sculptures (APIO15_sculpture) C++14
0 / 100
3 ms 684 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,a,b,arr[59];
ll dp[59][509];
ll bt(ll id,ll sum,ll curr,ll flag,bool flag2){
    if(id == n){
        if(flag < a || flag > b || !flag2) return 1000000009;
        return curr;
    }
    ll &ret = dp[id][sum];
    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 Correct 2 ms 512 KB Output is correct
2 Incorrect 2 ms 512 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 512 KB Output is correct
2 Incorrect 2 ms 512 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 512 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 512 KB Output is correct
2 Incorrect 2 ms 512 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 684 KB Output is correct
2 Incorrect 3 ms 512 KB Output isn't correct
3 Halted 0 ms 0 KB -