답안 #901514

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
901514 2024-01-09T13:46:17 Z ByeWorld Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
#define bupol __builtin_popcount
#define int long long 
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
const int MAXN = 2010;
const int MAXK = 205;
const int LOG = 31;
const int MOD = 1e9+7;
const int SQRT = 520;
const int INF = 2010;
typedef pair<ll,ll> pii;
typedef pair<ll,pii> ipii;
 
int n, x, y;
int a[MAXN], pr[MAXN];
pii dp[MAXN];

signed main(){
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n >> x >> y;
    for(int i=1; i<=n; i++){
        cin >> a[i]; pr[i] = pr[i-1]+a[i];
    }
    for(int i=0; i<=INF; i++){
        bool ans = 1;
        dp[0] = pii(0, 0);
        for(int j=1; j<=n; j++){
            dp[j].fi = INF; dp[j].se = -1;
            for(int k=0; k<=j-1; k++){
                int seg = pr[j]-pr[k];
                if((seg|i) != i) continue;  // gk valid
                
                dp[j].fi = min(dp[j].fi, dp[k].fi+1);
                dp[j].se = max(dp[j].se, dp[k].se+1);
            }
            if(dp[j].fi == INF) ans = 0;
        }
        if(ans && max(x, dp[n].fi)<=min(y, dp[n].se) ){
            cout << i << '\n';
            exit(0);
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 440 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -