# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
921102 | 2024-02-03T10:12:58 Z | shoryu386 | Kitchen (BOI19_kitchen) | C++17 | 141 ms | 262144 KB |
#include <bits/stdc++.h> using namespace std; #define int long long main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n, m, k; cin >> n >> m >> k; int buckets[n], balls[m]; for (int x = 0; x < n; x++) cin >> buckets[x]; for (int x = 0; x < m; x++) cin >> balls[x]; #define IMP cout << "Impossible"; return 0; bool dead = false; for (int x = 0; x < n; x++){ if (buckets[x] < k){ dead = true; } } if (dead) {IMP;} int bucketsum = 0; for (int x = 0; x < n; x++){ bucketsum += buckets[x]; } #define BSMAX 100000 bitset<BSMAX> hmm[m+1][n*k+1]; hmm[0][n*k][0] = 1; for (int x = 0; x < m; x++){ for (int z = 0; z <= n*k; z++){ hmm[x+1][max(0LL, z - min(balls[x], n))] |= (hmm[x][z] << balls[x]); hmm[x+1][z] |= hmm[x][z]; } } int ans = -1; for (int x = bucketsum; x < BSMAX; x++){ if (hmm[m][x][0]){ ans = x-bucketsum; break; } } if (ans == -1) cout << "Impossible"; else cout << ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 141 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 140 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |