제출 #1132377

#제출 시각아이디문제언어결과실행 시간메모리
1132377g4yuhgBali Sculptures (APIO15_sculpture)C++20
0 / 100
1 ms584 KiB
//Huyduocdithitp
#include <bits/stdc++.h>
typedef long long ll;
#define endl '\n'
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define fi first
#define se second
#define pii pair<ll, ll>
#define inf 1e9
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MP make_pair
#define TASK "cd"
#define start if(fopen(TASK".inp","r")){freopen(TASK".inp","r",stdin);freopen(TASK".out","w",stdout);}
#define LOG 31
#define N 500005
using namespace std;
ll n, L, R;
ll a[N], pf[N];
ll dp[205][205];
signed main(void) {
    faster;
    cin >> n >> L >> R;
    for (int i = 1; i <= n; i ++) {
        cin >> a[i];
        pf[i] = pf[i - 1] + a[i];
    }
    for (int i = 0; i < 205; i ++) {
        for (int j = 0; j < 205; j ++) {
            dp[i][j] = inf;
        }
    }
    dp[0][0] = 0;
    for (int i = 1; i <= n; i ++) {
        for (int k = 1; k <= R; k ++) {
            for (int j = i - 1; j >= k - 1; j --) {
                dp[i][k] = min(dp[i][k], ((pf[i] - pf[j]) | dp[j][k - 1]));
            }
        }
    }
    ll ans = inf;
    for (int i = L; i <= R; i ++) {
        ans = min(ans, dp[n][i]);
        //cout << i << " " << dp[n][i] << endl;
    }
    cout << ans;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...