답안 #1037595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037595 2024-07-29T05:29:33 Z stdfloat Bali Sculptures (APIO15_sculpture) C++17
0 / 100
163 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define all(v) (v).begin(), (v).end()

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);

    int n, A, B;
    cin >> n >> A >> B;

    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    int sm = 0;
    vector<vector<vector<int>>> dp(n, vector<vector<int>>(B));
    for (int i = 0; i < n; i++) {
        dp[i][0].push_back(sm += a[i]);

        for (int j = 1; j < B; j++) {
            int sm = 0;
            for (int k = i; k > 0 && !dp[k - 1][j - 1].empty(); k--) {
                sm += a[k];

                for (auto l : dp[k - 1][j - 1]) dp[i][j].push_back(l | sm);
            }
        }
    }

    int mn = INT_MAX;
    for (int i = A - 1; i < B; i++) {
        if (!dp[n - 1][i].empty()) mn = min(mn, *min_element(all(dp[n - 1][i])));
    }

    cout << mn << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 5 ms 4896 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 604 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 1116 KB Output is correct
22 Correct 1 ms 1116 KB Output is correct
23 Correct 1 ms 1116 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 1116 KB Output is correct
26 Correct 4 ms 4692 KB Output is correct
27 Incorrect 0 ms 348 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 4 ms 4964 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 600 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 1116 KB Output is correct
22 Correct 1 ms 1116 KB Output is correct
23 Correct 1 ms 1116 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 1116 KB Output is correct
26 Correct 4 ms 4692 KB Output is correct
27 Correct 8 ms 9356 KB Output is correct
28 Correct 28 ms 39736 KB Output is correct
29 Correct 4 ms 3352 KB Output is correct
30 Runtime error 161 ms 262144 KB Execution killed with signal 9
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 4 ms 4820 KB Output is correct
14 Correct 8 ms 9168 KB Output is correct
15 Correct 24 ms 37320 KB Output is correct
16 Correct 3 ms 3348 KB Output is correct
17 Runtime error 163 ms 262144 KB Execution killed with signal 9
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 548 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 6 ms 4820 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 604 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 1116 KB Output is correct
22 Correct 1 ms 1116 KB Output is correct
23 Correct 1 ms 1116 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 1116 KB Output is correct
26 Correct 4 ms 4692 KB Output is correct
27 Incorrect 0 ms 348 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 4 ms 4820 KB Output is correct
14 Incorrect 0 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -