답안 #745833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
745833 2023-05-21T08:30:38 Z vjudge1 Kitchen (BOI19_kitchen) C++17
9 / 100
17 ms 596 KB
#include <iostream>
#include <vector>

using namespace std;

bool dp[601][601];

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

    int n, m, k;
    cin >> n >> m >> k;

    vector<int> a(n);
    int total_work = 0;

    for (int& x : a) {
        cin >> x;

        total_work += x;

        if (x < k) {
            cout << "Impossible\n";
            return 0;
        }
    }

    int const difference_work = n * k;

    vector<int> b(m);
    for (int& x : b)
        cin >> x;

    dp[0][0] = true;

    for (int const& chef : b) {
        int const delta_d = min(chef, n);
        int const delta_t = chef;

        for (int d = 600; d >= delta_d; d--) {
            for (int t = 600; t >= delta_t; t--) {
                dp[d][t] |= dp[d - delta_d][t - delta_t];

                // if (dp[d][t]) {
                //     cout << "dp[" << d << "][" << t << "] possible!\n";
                // }
            }
        }
    }

    for (int t = total_work; t <= 600; t++) {
        for (int d = difference_work; d <= 600; d++) {
            if (dp[d][t]) {
                cout << t - total_work << "\n";
                return 0;
            }
        }
    }

    cout << "Impossible\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Incorrect 2 ms 596 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Incorrect 2 ms 596 KB Output isn't correct
10 Halted 0 ms 0 KB -