Submission #164202

# Submission time Handle Problem Language Result Execution time Memory
164202 2019-11-18T14:44:32 Z dolphingarlic Kitchen (BOI19_kitchen) C++14
0 / 100
113 ms 106408 KB
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;

int dp[301][90001];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m, k, sm = 0;
    cin >> n >> m >> k;
    if (m < k) return cout << "Impossible", 0;
    FOR(i, 0, n) {
        int a;
        cin >> a;
        if (a < k) return cout << "Impossible", 0;
        sm += a;
    }

    memset(dp, -1, sizeof(dp));
    dp[0][0] = 0;
    FOR(i, 1, m + 1) {
        int x;
        cin >> x;
        FOR(j, x, 90001) if (~dp[i - 1][j - x]) {
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - x] + min(x, n));
        }
    }

    FOR(i, sm, 90001) if (dp[m][i] >= n * k) return cout << i - sm, 0;
    cout << "Impossible";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 106360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 106360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 106408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 95 ms 106360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 106360 KB Output isn't correct
2 Halted 0 ms 0 KB -