Submission #918215

# Submission time Handle Problem Language Result Execution time Memory
918215 2024-01-29T13:34:08 Z Irate Bali Sculptures (APIO15_sculpture) C++14
0 / 100
0 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
const int mxN = 105;
long long dp[mxN][mxN];
int a, b, n;
vector<int>v;
long long rec(int indx, int x){
    long long res = 1e15, sum = 0;
    if(indx == n && x >= a && x <= b)return 0;
    if(indx == n)return 1e15;
    if(dp[indx][x] == -1)return dp[indx][x];
    for(int i = indx;i < n;++i){
        sum += v[i];
        res = min(res, sum | rec(i + 1, x + 1));
    }
    return dp[indx][x] = res;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> a >> b;
    v.resize(n);
    for(int i = 0;i < mxN;++i){
        for(int j = 0;j < mxN;++j){
            dp[i][j] = -1;
        }
    }
    for(int i = 0;i < n;++i){
        cin >> v[i];
    }
    cout << rec(0, 0);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -