답안 #660826

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
660826 2022-11-23T09:41:30 Z danikoynov Bali Sculptures (APIO15_sculpture) C++14
0 / 100
163 ms 4100 KB
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
typedef long long ll;

void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

const int maxn = 100, maxc = 8001;

int dp[51][20][maxc], n, A, B, a[maxn];
void solve()
{
    cin >> n >> A >> B;
    for (int i = 1; i <= n; i ++)
    {
        cin >> a[i];
    }

    dp[0][0][0] = 1;
    for (int i = 1; i <= n; i ++)
    {
        for (int j = 1; j <= B; j ++)
        {
            int sum = 0;
            for (int k = i; k > 0; k --)
            {
                sum = sum + a[k];
                for (int x = 0; x < maxc; x ++)
                {
                    int new_x = (x | sum);
                    if (dp[k - 1][j - 1][x] == 1)
                    dp[i][j][new_x] = 1;
                }
            }
        }
    }

    int best = maxc;
    for (int j = A; j <= B; j ++)
    {
        for (int x = 0; x < maxc; x ++)
        {
            if (dp[n][j][x] != 0)
            {
                best = min(best, x);
                break;
            }
        }
    }

        cout << best << endl;
}

int main()
{
    solve();
    return 0;
}
/**
6 1 3
8 1 2 1 5 4
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 12 ms 724 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 4 ms 468 KB Output is correct
9 Correct 4 ms 540 KB Output is correct
10 Correct 6 ms 468 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 6 ms 468 KB Output is correct
13 Correct 21 ms 1128 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 3 ms 468 KB Output is correct
19 Correct 12 ms 724 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
21 Correct 9 ms 724 KB Output is correct
22 Correct 9 ms 724 KB Output is correct
23 Correct 12 ms 804 KB Output is correct
24 Correct 3 ms 468 KB Output is correct
25 Correct 10 ms 724 KB Output is correct
26 Correct 16 ms 1052 KB Output is correct
27 Runtime error 1 ms 340 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 12 ms 764 KB Output is correct
7 Correct 5 ms 596 KB Output is correct
8 Correct 5 ms 468 KB Output is correct
9 Correct 4 ms 508 KB Output is correct
10 Correct 8 ms 524 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 5 ms 468 KB Output is correct
13 Correct 27 ms 1140 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 15 ms 776 KB Output is correct
20 Correct 4 ms 468 KB Output is correct
21 Correct 12 ms 748 KB Output is correct
22 Correct 11 ms 724 KB Output is correct
23 Correct 14 ms 724 KB Output is correct
24 Correct 5 ms 468 KB Output is correct
25 Correct 9 ms 724 KB Output is correct
26 Correct 19 ms 1016 KB Output is correct
27 Correct 43 ms 1204 KB Output is correct
28 Correct 24 ms 1188 KB Output is correct
29 Correct 23 ms 1008 KB Output is correct
30 Correct 93 ms 2888 KB Output is correct
31 Incorrect 163 ms 4044 KB Output isn't correct
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 16 ms 724 KB Output is correct
7 Correct 5 ms 468 KB Output is correct
8 Correct 4 ms 468 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 6 ms 468 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 5 ms 468 KB Output is correct
13 Correct 28 ms 1056 KB Output is correct
14 Correct 33 ms 1244 KB Output is correct
15 Correct 24 ms 1176 KB Output is correct
16 Correct 33 ms 988 KB Output is correct
17 Correct 102 ms 2856 KB Output is correct
18 Incorrect 155 ms 4100 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 23 ms 776 KB Output is correct
7 Correct 6 ms 500 KB Output is correct
8 Correct 5 ms 480 KB Output is correct
9 Correct 5 ms 468 KB Output is correct
10 Correct 5 ms 468 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 8 ms 492 KB Output is correct
13 Correct 22 ms 1072 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 4 ms 348 KB Output is correct
19 Correct 14 ms 724 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
21 Correct 9 ms 724 KB Output is correct
22 Correct 10 ms 764 KB Output is correct
23 Correct 9 ms 724 KB Output is correct
24 Correct 3 ms 468 KB Output is correct
25 Correct 9 ms 724 KB Output is correct
26 Correct 17 ms 976 KB Output is correct
27 Runtime error 1 ms 340 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 13 ms 748 KB Output is correct
7 Correct 4 ms 468 KB Output is correct
8 Correct 5 ms 468 KB Output is correct
9 Correct 5 ms 468 KB Output is correct
10 Correct 7 ms 468 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 4 ms 468 KB Output is correct
13 Correct 21 ms 1156 KB Output is correct
14 Runtime error 1 ms 340 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -