답안 #549155

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
549155 2022-04-15T10:29:24 Z CyberSleeper Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>
#define fastio      ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define debug(x)    cout << "Line " << __LINE__ << ", " << #x << " is " << x << endl
#define all(x)      x.begin(), x.end()
#define fi          first
#define se          second
#define mp          make_pair
#define pb          push_back
#define ll          long long
#define ull         unsigned long long
#define pll         pair<ll, ll>
#define pii         pair<ll, ll>
#define ld          long double
#define nl          endl
#define tb          '\t'
#define sp          ' '
#define sqr(x)      (x)*(x)
using namespace std;

const ll MX=2002, MOD=1000000007, BLOCK=327, INF=2e9+7, LG=62;
const ll INFF=1000000000000000007;
const ld ERR=1e-6, pi=3.14159265358979323846;

ll N, L, R, A[MX], pref[MX], ans, DP[2005];

ll getp(ll le, ll ri){
    return pref[ri]-pref[le-1];
}

int main(){
    fastio;
    cin >> N >> L >> R;
    for(ll i=1; i<=N; i++){
        cin >> A[i];
        pref[i]=pref[i-1]+A[i];
    }
    for(ll bit=LG; bit>=0; bit--){
        for(int i=0; i<=2002; i++)
            DP[i]=INF;
        DP[1]=0;
        for(ll i=1; i<=N; i++){
            for(ll k=i; k<=N; k++){
                ll tmp=(getp(i, k)>>bit);
                tmp=tmp<<bit;
                if((tmp|ans)==ans)
                    DP[k+1]=min(DP[k+1], DP[i]);
            }
        }
        if(DP[N+1]>R)
            ans+=(1ll<<bit);
    }
    cout << ans << nl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 0 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 0 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -