Submission #921098

# Submission time Handle Problem Language Result Execution time Memory
921098 2024-02-03T10:08:02 Z shoryu386 Kitchen (BOI19_kitchen) C++17
Compilation error
0 ms 0 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 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

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];
      |                                             ^~~~~