Submission #921107

#TimeUsernameProblemLanguageResultExecution timeMemory
921107shoryu386Kitchen (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 100000 bitset<BSMAX> hmm[n*k+1]; hmm[n*k][0] = 1; for (int x = 0; x < m; x++){ for (int z = n*(k-x-1); z <= n*(k-x); z++){ hmm[max(0LL, z - min(balls[x], n))] |= (hmm[z] << balls[x]); } } int ans = -1; for (int x = bucketsum; x < BSMAX; x++){ if (hmm[0][x]){ ans = x-bucketsum; break; } } if (ans == -1) cout << "Impossible"; else cout << ans; }

Compilation message (stderr)

kitchen.cpp:1:2: error: stray '#' in program
    1 | ]#include <bits/stdc++.h>
      |  ^
kitchen.cpp:1:1: error: expected unqualified-id before ']' token
    1 | ]#include <bits/stdc++.h>
      | ^
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:7:2: error: 'ios_base' has not been declared
    7 |  ios_base::sync_with_stdio(0); cin.tie(0);
      |  ^~~~~~~~
kitchen.cpp:7:32: error: 'cin' was not declared in this scope
    7 |  ios_base::sync_with_stdio(0); cin.tie(0);
      |                                ^~~
kitchen.cpp:16:14: error: 'cout' was not declared in this scope
   16 |  #define IMP cout << "Impossible"; return 0;
      |              ^~~~
kitchen.cpp:24:13: note: in expansion of macro 'IMP'
   24 |  if (dead) {IMP;}
      |             ^~~
kitchen.cpp:33:2: error: 'bitset' was not declared in this scope
   33 |  bitset<BSMAX> hmm[n*k+1];
      |  ^~~~~~
kitchen.cpp:33:16: error: 'hmm' was not declared in this scope
   33 |  bitset<BSMAX> hmm[n*k+1];
      |                ^~~
kitchen.cpp:39:21: error: 'min' was not declared in this scope; did you mean 'main'?
   39 |    hmm[max(0LL, z - min(balls[x], n))] |= (hmm[z] << balls[x]);
      |                     ^~~
      |                     main
kitchen.cpp:39:8: error: 'max' was not declared in this scope
   39 |    hmm[max(0LL, z - min(balls[x], n))] |= (hmm[z] << balls[x]);
      |        ^~~
kitchen.cpp:50:17: error: 'cout' was not declared in this scope
   50 |  if (ans == -1) cout << "Impossible";
      |                 ^~~~
kitchen.cpp:51:7: error: 'cout' was not declared in this scope
   51 |  else cout << ans;
      |       ^~~~