Submission #921098

#TimeUsernameProblemLanguageResultExecution timeMemory
921098shoryu386Kitchen (BOI19_kitchen)C++17
Compilation error
0 ms0 KiB
#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 1607 bool hmm[m+1][BSMAX][n*k+1]; hmm[0][0][n*k] = 1; for (int x = 0; x < m; x++){ for (int y = 0; y < BSMAX; y++){ for (int z = 0; z <= n*k+1; z++){ if (!hmm[x][y][z]) continue; hmm[x+1][y + balls[x]][max(0LL, z - min(chefs[x], n))] |= hmm[x][y][z]; hmm[x+1][y][z] |= hmm[x][y][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 (stderr)

kitchen.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
kitchen.cpp: In function 'int main()':
kitchen.cpp:41:45: error: 'chefs' was not declared in this scope
   41 |     hmm[x+1][y + balls[x]][max(0LL, z - min(chefs[x], n))] |= hmm[x][y][z];
      |                                             ^~~~~