답안 #660822

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
660822 2022-11-23T09:39:33 Z danikoynov Bali Sculptures (APIO15_sculpture) C++14
0 / 100
12 ms 852 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;

int dp[51][21][8001], 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 < 8001; x ++)
                {
                    int new_x = (x | sum);
                    if (dp[k - 1][j - 1][x] == 1)
                    dp[i][j][new_x] = 1;
                }
            }
        }
    }

    int best = 100;
    for (int j = A; j <= B; j ++)
    {
        for (int x = 0; x < 8000; 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 1 ms 212 KB Output is correct
4 Correct 2 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 4 ms 476 KB Output is correct
8 Correct 6 ms 468 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 4 ms 468 KB Output is correct
11 Incorrect 2 ms 340 KB Output isn't correct
12 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 11 ms 724 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 5 ms 468 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 5 ms 556 KB Output is correct
11 Incorrect 2 ms 340 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 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 11 ms 724 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 4 ms 456 KB Output is correct
9 Correct 4 ms 532 KB Output is correct
10 Correct 5 ms 468 KB Output is correct
11 Incorrect 2 ms 340 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 11 ms 852 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 4 ms 468 KB Output is correct
9 Correct 7 ms 468 KB Output is correct
10 Correct 5 ms 468 KB Output is correct
11 Incorrect 2 ms 340 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 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 784 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 468 KB Output is correct
10 Correct 4 ms 468 KB Output is correct
11 Incorrect 2 ms 340 KB Output isn't correct
12 Halted 0 ms 0 KB -