Submission #745863

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

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;

	for(int i = 0; i < whours.size(); i++){
		cntw += whours[i];
	}
	//cout << cntw;
	if(m < k)cout << "Impossible";
	
	else if(m == 2 && k == 1){
		for(int i = 0; i < reality.size(); i++){
			cntr = min(cntr, reality[i]);
		}
		cout << cntw - cntr;
	}
	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:21:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for(int i = 0; i < whours.size(); i++){
      |                 ~~^~~~~~~~~~~~~~~
kitchen.cpp:28:20: 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 < reality.size(); i++){
      |                  ~~^~~~~~~~~~~~~~~~
kitchen.cpp:34:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   for(int i = 0; i < reality.size(); i++){
      |                  ~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -