Submission #634045

# Submission time Handle Problem Language Result Execution time Memory
634045 2022-08-23T17:57:13 Z tvladm2009 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 340 KB
#include <iostream>
#define int long long

using namespace std;

const int MAX_N = 2 * 1e3;
const int INF = (1LL << 60);
const int MAX_L = 11;
int y[MAX_N + 1], range[MAX_N + 1][MAX_N + 1], dp[MAX_N + 1][MAX_N + 1];
int n, a, b;

signed main() {
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++) {
        cin >> y[i];
        range[i][i] = y[i];
    }
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            range[i][j] = range[i][j - 1] + y[j];
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            dp[i][j] = INF;
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 1; k <= i; k++) {
                dp[i][j] = min(dp[i][j], (dp[k - 1][j - 1] | range[k][i]));
            }
        }
    }
    int answer = INF;
    for (int i = a; i <= b; i++) {
        answer = min(answer, dp[n][i]);
    }
    cout << answer;
    return 0;
}
/*
6 1 3
8 1 2 1 5 4
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 312 KB Output is correct
2 Incorrect 0 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 308 KB Output isn't correct
3 Halted 0 ms 0 KB -