Submission #1028507

# Submission time Handle Problem Language Result Execution time Memory
1028507 2024-07-20T03:10:16 Z vjudge1 Bali Sculptures (APIO15_sculpture) C++17
0 / 100
16 ms 31896 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N = 2005;
int n, x, y;
ll a[N], dp[N][N];

int main(){
    memset(dp, 63, sizeof dp);

    cin >> n >> x >> y;
    for (int i = 1; i <= n; i ++)
        cin >> a[i], a[i] += a[i - 1];

    for (int i = 1; i <= n; i ++){
        for (int j = 1; j <= i; j ++){
            if (j == 1){
                dp[i][j] = a[i];
                continue;
            }

            for (int k = 1; k < i; k ++)
                dp[i][j] = min(dp[i][j], dp[k][j - 1] | (a[i] - a[k]));
        }
    }

    ll ans = 1e18;
    for (int i = x; i <= y; i ++)
        ans = min(ans, dp[n][i]);
    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 13 ms 31756 KB Output is correct
2 Incorrect 13 ms 31680 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 31800 KB Output is correct
2 Incorrect 15 ms 31836 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 31888 KB Output is correct
2 Incorrect 13 ms 31836 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 31836 KB Output is correct
2 Incorrect 13 ms 31836 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 31812 KB Output is correct
2 Incorrect 13 ms 31896 KB Output isn't correct
3 Halted 0 ms 0 KB -