Submission #745887

# Submission time Handle Problem Language Result Execution time Memory
745887 2023-05-21T09:19:52 Z vjudge1 Kitchen (BOI19_kitchen) C++17
0 / 100
215 ms 90576 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;


const int N = 300;
const int M = 15;

int main(){
	int n, m, k; cin >> n >> m >> k;
	vector <int> whours(n);
	for(int i = 0; i < n; i++){
		cin >> whours[i];
	}
	vector <int> reality(m);
	for(int i = 0; i < m; i++){
		cin >> reality[i];
	}

	/*for(int i : whours) cout << i <<endl;
	for(int i : reality) cout << i;*/
	int cntw = 0;
	int cntr = 0;
	int dif = n*k;
	int maxi = N*(M+1);
	int darab, darab2 = 0;

	for(int i = 0; i < whours.size(); i++){
		cntw += whours[i];
	}
	
	if(m < k || dif > maxi)cout << "Impossible\n";
	int dp[maxi+1][maxi+1];

	for(int c = 0; c < reality.size(); c++){
		darab = min(darab, c);
		darab2 = c;
	}

	for(int i = maxi; i >= darab; i--){
		for(int j = maxi; j >= darab2; j--){
			dp[darab][darab2] |= dp[i - darab][j - darab2];
		}
	}

	for(int i = cntw; i < maxi; i++){
		for(int j = dif; j < maxi; j++){
			if(dp[j][i]){
				cout << i - maxi << '\n';
			}
		}
		//cout << "Impossible\n";
	}

	/*else if(m == 2 && k == 1){
		for(int i = 0; i < reality.size(); i++){
			cntr = min(cntr, reality[i]);
		}
		cout << cntr - cntw;
	}
	else{
		for(int i = 0; i < reality.size(); i++){
			cntr += reality[i];
		}
		cout << cntr - cntw;
	}*/

}

Compilation message

kitchen.cpp: In function 'int main()':
kitchen.cpp:28:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for(int i = 0; i < whours.size(); i++){
      |                 ~~^~~~~~~~~~~~~~~
kitchen.cpp:35:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |  for(int c = 0; c < reality.size(); c++){
      |                 ~~^~~~~~~~~~~~~~~~
kitchen.cpp:23:6: warning: unused variable 'cntr' [-Wunused-variable]
   23 |  int cntr = 0;
      |      ^~~~
kitchen.cpp:42:22: warning: 'darab' may be used uninitialized in this function [-Wmaybe-uninitialized]
   42 |    dp[darab][darab2] |= dp[i - darab][j - darab2];
      |    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 215 ms 90368 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 215 ms 90368 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 90576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 173 ms 90460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 215 ms 90368 KB Output isn't correct
2 Halted 0 ms 0 KB -