답안 #602707

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
602707 2022-07-23T10:27:27 Z proma Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>

#define int unsigned long long
#define see(x) cout<<#x<<"="<<x<<endl;
#define endl "\n"

using namespace std;

const int N = 2*1e5+5;
const int INF = 1e18;

int n, a, b, y[105];
int dp[105][105], pref[105];


int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
/*
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
*/

    cin >> n >> a >> b;

    for (int i = 1; i <= n; i ++) {
        cin >> y[i];
        pref[i] = pref[i-1] + y[i];
    }

    for (int i = 1; i <= n; i ++) {
        dp[i][1] = pref[i];
        for (int j = 2; j <= min(i, b); j ++) {
            dp[i][j] = (dp[j-1][j-1] | (pref[i] - pref[j-1]));
            for (int k = j; k < i; k ++) {
                dp[i][j] = min(dp[i][j], (dp[k][j-1] | (pref[i] - pref[k])));
            }
        }
    }

    int res = dp[n][a];
    for (int i = a; i <= b; i ++) {
        res = min(res, dp[n][i]);
    }

    cout << res << endl;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -