# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
428267 | 2021-06-15T09:20:30 Z | schse | Kitchen (BOI19_kitchen) | C++17 | 46 ms | 292 KB |
#include <bits/stdc++.h> using namespace std; int main() { int N, M, K; cin >> N >> M >> K; vector<int> recipes(N), chefs(M); for (int &i : recipes) cin >> i; for (int &i : chefs) cin >> i; int totalwork = accumulate(recipes.begin(), recipes.end(), 0); int mnovertme = INT32_MAX; vector<bool> workable(totalwork); workable[0] = true; for (int chef : chefs) { for (int i = workable.size() - 1; i >= 0; i--) { if (workable[i] && i + chef < workable.size()) workable[i + chef] = true; else if (workable[i]) mnovertme = min(mnovertme, i + chef - totalwork); } } if (mnovertme == INT32_MAX || (M > 1 && K > 1 && min(chefs[0], chefs[1]) < N) || K > M) cout << "Impossible\n"; else cout << mnovertme; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 0 ms | 204 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 0 ms | 204 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 288 KB | Output is correct |
2 | Correct | 18 ms | 292 KB | Output is correct |
3 | Correct | 27 ms | 204 KB | Output is correct |
4 | Correct | 44 ms | 204 KB | Output is correct |
5 | Correct | 46 ms | 292 KB | Output is correct |
6 | Correct | 16 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 0 ms | 204 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |