답안 #745900

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
745900 2023-05-21T09:27:50 Z vjudge1 Kitchen (BOI19_kitchen) C++17
0 / 100
70 ms 90436 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[i][j]){
				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];
      |    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 70 ms 90384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 70 ms 90384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 54 ms 90436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 63 ms 90404 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 70 ms 90384 KB Output isn't correct
2 Halted 0 ms 0 KB -