답안 #778702

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
778702 2023-07-10T15:10:49 Z benjaminkleyn Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1000 ms 340 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma,bmi,bmi2")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n, A, B;
ll x[2000];

int k = 0;
ll y[2000];

ll search(int i = 0)
{
    if (i == n)
    {
        if (B < k)
            return LLONG_MAX;

        ll ans = 0;
        for (int j = 0; j < k; j++)
            ans |= y[j];

        return ans;
    }

    ll ans = LLONG_MAX;

    if (k > 0)
    {
        y[k-1] += x[i];
        ans = min(ans, search(i + 1));
        y[k-1] -= x[i];
    }

    y[k++] = x[i];
    ans = min(ans, search(i + 1));
    y[--k] = 0;

    return ans;
}

int main()
{
    cin.tie(0)->sync_with_stdio(0);

    cin >> n >> A >> B;
    for (int i = 0; i < n; i++)
        cin >> x[i];

    cout << search() << '\n';

    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 0 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 3 ms 212 KB Output is correct
9 Correct 3 ms 324 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 3 ms 328 KB Output is correct
12 Correct 3 ms 212 KB Output is correct
13 Correct 5 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Incorrect 1 ms 212 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 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 328 KB Output is correct
8 Correct 3 ms 324 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 3 ms 212 KB Output is correct
12 Correct 3 ms 212 KB Output is correct
13 Correct 6 ms 324 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Incorrect 1 ms 212 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 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 324 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 3 ms 324 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 3 ms 212 KB Output is correct
12 Correct 4 ms 212 KB Output is correct
13 Correct 6 ms 212 KB Output is correct
14 Correct 10 ms 328 KB Output is correct
15 Correct 93 ms 304 KB Output is correct
16 Execution timed out 1088 ms 212 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 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 320 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Correct 4 ms 212 KB Output is correct
10 Correct 5 ms 212 KB Output is correct
11 Correct 4 ms 212 KB Output is correct
12 Correct 3 ms 212 KB Output is correct
13 Correct 5 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Incorrect 0 ms 212 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 3 ms 324 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 3 ms 212 KB Output is correct
12 Correct 3 ms 320 KB Output is correct
13 Correct 6 ms 212 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 2 ms 212 KB Output is correct
18 Correct 5 ms 328 KB Output is correct
19 Correct 3 ms 320 KB Output is correct
20 Correct 6 ms 332 KB Output is correct
21 Correct 5 ms 212 KB Output is correct
22 Correct 3 ms 328 KB Output is correct
23 Correct 7 ms 212 KB Output is correct
24 Correct 10 ms 328 KB Output is correct
25 Correct 116 ms 212 KB Output is correct
26 Execution timed out 1040 ms 212 KB Time limit exceeded
27 Halted 0 ms 0 KB -