# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
522787 | 2022-02-05T19:32:24 Z | LucaDantas | Kitchen (BOI19_kitchen) | C++17 | 1 ms | 204 KB |
#include <cstdio> #include <algorithm> using namespace std; constexpr int maxn = 310, inf = 0x3f3f3f3f; int a[maxn], b[maxn], ex[maxn]; int dp[maxn*maxn]; int main() { int n, m, k, soma = 0; scanf("%d %d %d", &n, &m, &k); for(int i = 0; i < n; i++) { scanf("%d", a+i), soma += a[i]; if(a[i] < k) return puts("impossible"), 0; } for(int i = 0; i < m; i++) scanf("%d", b+i); int ans = inf; for(int mask = 0; mask < (1 << m); mask++) { int tot = 0, bom = 0; for(int i = 0; i < m; i++) if(mask & (1 << i)) tot += b[i], bom += min(n, b[i]); if(tot >= soma && bom >= n*k) ans = min(ans, tot); } if(ans == inf) puts("impossible"); else printf("%d\n", ans-soma); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Incorrect | 1 ms | 204 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Incorrect | 1 ms | 204 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 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 | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Incorrect | 1 ms | 204 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |