답안 #231833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
231833 2020-05-15T04:20:16 Z kshitij_sodani Kitchen (BOI19_kitchen) C++17
20 / 100
49 ms 1024 KB
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef int64_t llo;
#define mp make_pair
#define a first
#define b second
#define pb push_back
int n,m,k;
int aa[301];
int bb[301];
const int li=400*400;
int dp[li];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	memset(dp,0,sizeof(dp));
	dp[0]=1;
	cin>>n>>m>>k;
	int su=0;

	for(int i=0;i<n;i++){
		cin>>aa[i];
		su+=aa[i];
	}
	for(int i=0;i<m;i++){
		cin>>bb[i];
	}
	for(int i=0;i<m;i++){
		for(int j=li;j>=bb[i];j--){
			dp[j]=max(dp[j],dp[j-bb[i]]);
		}
	}
	int ans=-1;
	for(int i=su;i<li;i++){
		if(dp[i]){
			ans=i-su;
			break;
		}
	}
	if(ans==-1){
		cout<<"Impossible"<<endl;
	}
	else{
		cout<<ans<<endl;
	}















	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 896 KB Output is correct
2 Correct 5 ms 896 KB Output is correct
3 Correct 5 ms 896 KB Output is correct
4 Incorrect 5 ms 1024 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 896 KB Output is correct
2 Correct 5 ms 896 KB Output is correct
3 Correct 5 ms 896 KB Output is correct
4 Incorrect 5 ms 1024 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 1024 KB Output is correct
2 Correct 37 ms 896 KB Output is correct
3 Correct 49 ms 1024 KB Output is correct
4 Correct 48 ms 1024 KB Output is correct
5 Correct 46 ms 896 KB Output is correct
6 Correct 35 ms 1016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 1024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 896 KB Output is correct
2 Correct 5 ms 896 KB Output is correct
3 Correct 5 ms 896 KB Output is correct
4 Incorrect 5 ms 1024 KB Output isn't correct
5 Halted 0 ms 0 KB -