# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
747728 | 2023-05-24T15:08:44 Z | nguyentunglam | Kitchen (BOI19_kitchen) | C++17 | 2 ms | 324 KB |
#include<bits/stdc++.h> #define fi first #define se second #define endl "\n" #define ii pair<int, int> using namespace std; const int N = 310; int b[N]; int main() { #define task "" cin.tie(0) -> sync_with_stdio(0); if (fopen ("task.inp", "r")) { freopen ("task.inp", "r", stdin); freopen ("task.out", "w", stdout); } if (fopen (task".inp", "r")) { freopen (task".inp", "r", stdin); freopen (task".out", "w", stdout); } int n, m, k; cin >> n >> m >> k; int sum = 0, ans = 1e9; for(int i = 1; i <= n; i++) { int x; cin >> x; if (x < k) return cout << "Impossible", 0; sum += x; } for(int i = 0; i < m; i++) cin >> b[i]; for(int mask = 0; mask < (1 << m); mask++) { int sum1 = 0, sum2 = 0; for(int i = 0; i < m; i++) if (mask >> i & 1) { sum1 += min(n, b[i]); sum2 += b[i]; } if (sum1 >= n * k && sum2 >= sum) ans = min(ans, sum2 - sum); } if (ans == 1e9) return cout << "Impossible", 0; cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 324 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 324 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 324 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 324 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 2 ms | 324 KB | Output is correct |
10 | Correct | 2 ms | 212 KB | Output is correct |
11 | Correct | 2 ms | 212 KB | Output is correct |
12 | Correct | 2 ms | 212 KB | Output is correct |
13 | Correct | 2 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 324 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 324 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 324 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 2 ms | 324 KB | Output is correct |
10 | Correct | 2 ms | 212 KB | Output is correct |
11 | Correct | 2 ms | 212 KB | Output is correct |
12 | Correct | 2 ms | 212 KB | Output is correct |
13 | Correct | 2 ms | 212 KB | Output is correct |
14 | Incorrect | 1 ms | 212 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |