답안 #928776

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928776 2024-02-17T05:40:46 Z UmairAhmadMirza Kitchen (BOI19_kitchen) C++17
41 / 100
21 ms 688 KB
#include <bits/stdc++.h>
using namespace std;
int const N=305;
int const inf=1e9;
int dp[N*N];
int n,m,k;
int main(){
  cin>>n>>m>>k;
  int arr[n];
  int total=0;
  for(int i=0;i<n;i++){
    cin>>arr[i];
    total+=arr[i];
    if(arr[i]<k){
      cout<<"Impossible"<<endl;
      return 0;
    }
  }
  int chef[m];
  dp[0]=1;
  for(int i=0;i<m;i++)
    cin>>chef[i];
  for(int i=0;i<m;i++){
    for(int tot=(N*m);tot>=chef[i];tot--){
      if(dp[tot-chef[i]]==0)
        continue;
      dp[tot]=max(dp[tot-chef[i]]+min(chef[i],n),dp[tot]);
    }
  }
  for(int i=0;i<=N;i++){
    if(dp[total+i]-1>=(k*n)){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<"Impossible"<<endl;
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 604 KB Output is correct
2 Correct 12 ms 636 KB Output is correct
3 Correct 19 ms 604 KB Output is correct
4 Correct 21 ms 688 KB Output is correct
5 Correct 21 ms 600 KB Output is correct
6 Correct 10 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 428 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -