Submission #107887

# Submission time Handle Problem Language Result Execution time Memory
107887 2019-04-26T07:30:21 Z dfistric Bali Sculptures (APIO15_sculpture) C++14
0 / 100
3 ms 384 KB
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ll long long

using namespace std;

const int MAXN = 2010;
ll arr[MAXN];
int n, a, b;

namespace code1 {
    ll dp[MAXN][MAXN];
    ll pref[MAXN];

    void solve() {
        REP(i, n) {
            pref[i] = arr[i];
            if (i) pref[i] += pref[i - 1];
        }

        REP(i, n) {
            dp[i][1] = pref[i];
            FOR(j, 2, n) {
                dp[i][j] = (1LL << 60);
                REP(k, i - 1) {
                    dp[i][j] = min(dp[i][j], (dp[k][j - 1] | (pref[i] - pref[k])));
                }

            }
        }

        ll out = (1LL << 60);
        FOR(i, a, b + 1) out = min(out, dp[n - 1][i]);
        cout << out << "\n";

        return; 
    }
};

int main() {
    ios_base::sync_with_stdio(false);

    cin >> n >> a >> b;
    REP(i, n) cin >> arr[i];

    code1::solve();


    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 3 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -