Submission #465423

# Submission time Handle Problem Language Result Execution time Memory
465423 2021-08-16T02:44:08 Z bonopo Kitchen (BOI19_kitchen) C++14
21 / 100
30 ms 700 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 = MM-1-x; 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 1 ms 588 KB Output is correct
2 Incorrect 1 ms 588 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 588 KB Output is correct
2 Incorrect 1 ms 588 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 588 KB Output is correct
2 Correct 5 ms 604 KB Output is correct
3 Correct 4 ms 700 KB Output is correct
4 Correct 5 ms 588 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 588 KB Output is correct
2 Incorrect 1 ms 588 KB Output isn't correct
3 Halted 0 ms 0 KB -