답안 #107892

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
107892 2019-04-26T07:32:40 Z dfistric Bali Sculptures (APIO15_sculpture) C++14
0 / 100
4 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 + 1) {
                dp[i][j] = (1LL << 60);
                REP(k, i) {
                    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;
}
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 4 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -