답안 #667179

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
667179 2022-11-30T16:07:26 Z Kahou Bali Sculptures (APIO15_sculpture) C++14
9 / 100
31 ms 340 KB
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define endl '\n'
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;

const int N = 20;
int n, A, B;
ll Y[N];
ll ans;

void solve() {
    cin >> n >> A >> B;
    for (int i = 0; i < n; i++) {
        cin >> Y[i];
    }
    ans = 1e18;
    int M = (1<<(n-1));

    for (int mask = 0; mask < M; mask++) {
        if (__builtin_popcount(mask)+1 < A || __builtin_popcount(mask)+1 > B) continue;

        ll sm = 0;
        ll tmp = 0;
        for (int i = 0; i < n; i++) {
            sm += Y[i];
            if (mask>>i&1) {
                tmp |= sm;
                sm = 0;
            }
        }
        tmp |= sm;
        sm = 0;
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 320 KB Output is correct
13 Correct 30 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 316 KB Output is correct
21 Correct 5 ms 320 KB Output is correct
22 Correct 5 ms 212 KB Output is correct
23 Correct 6 ms 320 KB Output is correct
24 Correct 2 ms 320 KB Output is correct
25 Correct 5 ms 212 KB Output is correct
26 Correct 27 ms 212 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 0 ms 324 KB Output is correct
29 Correct 1 ms 320 KB Output is correct
30 Correct 1 ms 316 KB Output is correct
31 Correct 4 ms 212 KB Output is correct
32 Correct 2 ms 212 KB Output is correct
33 Correct 27 ms 212 KB Output is correct
34 Correct 29 ms 300 KB Output is correct
35 Correct 2 ms 212 KB Output is correct
36 Correct 30 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 240 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 324 KB Output is correct
10 Correct 2 ms 320 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 3 ms 212 KB Output is correct
13 Correct 30 ms 300 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 4 ms 212 KB Output is correct
23 Correct 5 ms 212 KB Output is correct
24 Correct 2 ms 324 KB Output is correct
25 Correct 4 ms 212 KB Output is correct
26 Correct 27 ms 212 KB Output is correct
27 Incorrect 3 ms 212 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 7 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 30 ms 212 KB Output is correct
14 Incorrect 3 ms 212 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 216 KB Output is correct
7 Correct 1 ms 216 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 316 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 31 ms 336 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 316 KB Output is correct
16 Correct 1 ms 216 KB Output is correct
17 Correct 0 ms 260 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 216 KB Output is correct
20 Correct 1 ms 216 KB Output is correct
21 Correct 5 ms 212 KB Output is correct
22 Correct 5 ms 212 KB Output is correct
23 Correct 4 ms 212 KB Output is correct
24 Correct 2 ms 320 KB Output is correct
25 Correct 5 ms 216 KB Output is correct
26 Correct 26 ms 220 KB Output is correct
27 Correct 1 ms 316 KB Output is correct
28 Correct 1 ms 216 KB Output is correct
29 Correct 1 ms 324 KB Output is correct
30 Correct 1 ms 216 KB Output is correct
31 Correct 4 ms 328 KB Output is correct
32 Correct 2 ms 220 KB Output is correct
33 Correct 27 ms 300 KB Output is correct
34 Correct 29 ms 220 KB Output is correct
35 Correct 2 ms 212 KB Output is correct
36 Correct 30 ms 300 KB Output is correct
37 Incorrect 3 ms 328 KB Output isn't correct
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 216 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 2 ms 316 KB Output is correct
9 Correct 2 ms 320 KB Output is correct
10 Correct 2 ms 316 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 324 KB Output is correct
13 Correct 31 ms 300 KB Output is correct
14 Correct 1 ms 216 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 216 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 4 ms 320 KB Output is correct
19 Correct 2 ms 216 KB Output is correct
20 Correct 27 ms 212 KB Output is correct
21 Correct 30 ms 212 KB Output is correct
22 Correct 2 ms 212 KB Output is correct
23 Correct 31 ms 316 KB Output is correct
24 Incorrect 3 ms 212 KB Output isn't correct
25 Halted 0 ms 0 KB -