답안 #602665

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

#define int 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] = INF;
            for (int k = j - 1; k < i; k ++) {
                dp[i][j] = min(dp[i][j], (dp[k][j-1] | (pref[i] - pref[k])));
            }
        }
    }

    int res = INF;
    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 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 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 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -