# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
745869 | 2023-05-21T08:58:39 Z | vjudge1 | Kitchen (BOI19_kitchen) | C++17 | 3 ms | 312 KB |
#include <iostream> #include <vector> #include <queue> #include <algorithm> using namespace std; struct meal { int t, k; bool operator<(const meal& m)const { return k < m.k; } }; int sum1, sum2; int check(int mask, vector<int>& ch, vector<meal>& m) { priority_queue<meal> q; int x = sum1, y = sum2; for (int i = 0; i < ch.size(); i++) { if (((1 << i)&mask) == 0)continue; x -= ch[i]; y -= min((int)m.size(), ch[i]); } if (y > 0 || x > 0)return INT32_MAX; return -x; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m, k; cin >> n >> m >> k; vector<meal> meals(n); bool b = 1; for (int i = 0; i < n; i++) { cin >> meals[i].t; meals[i].k = k; if (meals[i].t < k)b = 0; sum1 += meals[i].t; sum2 += k; } vector<int> ch(m); for (int& i : ch)cin >> i; int ans = INT32_MAX; for (int i = 0; i < (1 << m); i++) { ans = min(ans, check(i, ch, meals)); } if (ans == INT32_MAX || !b)cout << "Impossible\n"; else cout << ans << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 2 ms | 312 KB | Output is correct |
10 | Correct | 2 ms | 212 KB | Output is correct |
11 | Correct | 2 ms | 212 KB | Output is correct |
12 | Correct | 3 ms | 212 KB | Output is correct |
13 | Correct | 2 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 2 ms | 312 KB | Output is correct |
10 | Correct | 2 ms | 212 KB | Output is correct |
11 | Correct | 2 ms | 212 KB | Output is correct |
12 | Correct | 3 ms | 212 KB | Output is correct |
13 | Correct | 2 ms | 212 KB | Output is correct |
14 | Incorrect | 0 ms | 212 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |