| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1020143 | KasymK | Bali Sculptures (APIO15_sculpture) | C++17 | 1 ms | 444 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
const int N = 2e3+5;
ll dp[N][N], par[N];
int main(){
    // freopen("file.txt", "r", stdin);
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i <= n; ++i)
        for(int k = 0; k <= n; ++k)
            dp[i][k] = 1e18;
    vector<int> v(n);
    for(int &i : v)
        scanf("%d", &i);
    for(int i = 1; i <= n; ++i)
        par[i] = par[i-1]+v[i-1];
    dp[0][0] = 0;
    for(int i = 1; i <= n; ++i)
        for(int k = 1; k <= b; ++k)
            for(int j = 0; j < i; ++j)
                dp[i][k] = min(dp[i][k], dp[j][k-1]|(par[i]-par[j]));
    ll ans = 1e18;
    for(int k = a; k <= b; ++k)
        ans = min(ans, dp[n][k]);
    printf("%lld", ans);
    return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
