Submission #465422

# Submission time Handle Problem Language Result Execution time Memory
465422 2021-08-16T02:22:25 Z bonopo Kitchen (BOI19_kitchen) C++14
21 / 100
9 ms 460 KB
#include <bits/stdc++.h>
using namespace std;
#define el "\n"

typedef long long ll;
const int MM = 1e5+5, MOD = 1e9+7;
int N, M, K, wst = 1e9, sum, dp[MM];

int main() {
    cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false);
    cin >> N >> M >> K;
    for(int i = 1, x; i <= N; i++) cin >> x, wst = min(wst, x), sum += x;
    if(wst < K) { cout << "Impossible" << el; return 0; }
    for(int i = 1, x, s = 0; i <= M; i++) {
        cin >> x; s += x;
        for(int j = s; j >= 0; j--) {
            dp[j+x] = max(dp[j+x], dp[j] + min(x, N)); }
    } for(int i = sum; i < MM; i++) if(dp[i] >= N*K) { cout << i - sum << el; return 0; }
    cout << "Impossible" << el;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -