답안 #838913

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
838913 2023-08-28T09:17:23 Z drkarlicio2107 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 852 KB
#include <bits/stdc++.h>
using namespace std;
long long int pref [2010];
long long int dp [35][2010];
long long 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;
    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];
    long long int ans=0;
    for (long long int b=30; b>=0; b--){
        for (int i=0; i<n; i++){
            if ((((ans >> b) | ((pref [i])>>b)) == (ans >> b))) dp [b][0]=1;
            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|=((long long)1<<b);
    }
    cout << ans << endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Incorrect 1 ms 852 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Incorrect 1 ms 852 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Incorrect 1 ms 852 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Incorrect 1 ms 852 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Incorrect 1 ms 808 KB Output isn't correct
3 Halted 0 ms 0 KB -