Submission #838912

# Submission time Handle Problem Language Result Execution time Memory
838912 2023-08-28T09:13:27 Z drkarlicio2107 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 468 KB
#include <bits/stdc++.h>
using namespace std;
int pref [2010];
int dp [35][2010];
int l [2010];
int main(){
    for (int i=0; i<35; i++){
        for (int j=0; j<2010; j++) dp [i][j]=1e9;
    }
    int n, gra, grb; cin >> n >> gra >> grb; gra--; grb--;
    for (int i=0; i<n; i++) cin >> l [i];
    pref [0]=l [0];
    for (int i=1; i<n; i++) pref [i]=pref [i-1]+l [i];
    int ans=0;
    for (int b=30; b>=0; b--){
        for (int i=0; i<n; i++){
            if ((((ans >> b) | ((pref [i])>>b)) == (ans >> b))) dp [b][0]=0;
            for (int j=i-1; j>=0; j--){
                if ((((ans >> b) | ((pref [i]-pref [j])>>b)) == (ans >> b))) dp [b][i]=min (dp [b][i], dp [b][j]+1);
            }
        }
        //cout << dp [b][n-1] << " " << b << endl;
        if (dp [b][n-1]>grb) ans|=(1<<b);
    }
    cout << ans << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -