Submission #928763

# Submission time Handle Problem Language Result Execution time Memory
928763 2024-02-17T05:01:12 Z UmairAhmadMirza Kitchen (BOI19_kitchen) C++17
31 / 100
2 ms 444 KB
#include <bits/stdc++.h>
using namespace std;
int const N=305;
int const inf=1e9;
bool 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 ans=inf;
  int chef[m];
  for(int i=0;i<m;i++)
    cin>>chef[i];
  for(int mask=1;mask<(1<<m);mask++){
    int t_sum=0;
    int uni_sum=0;
    for(int i=0;i<m;i++)
      if((1<<i)&mask){
        t_sum+=chef[i];
        uni_sum+=min(n,chef[i]);
      }
    if((k*n)<=uni_sum && total<=t_sum)
      ans=min(ans,t_sum-total);
  }
  if(ans==inf)
    cout<<"Impossible"<<endl;
  else
    cout<<ans<<endl;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 2 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 2 ms 444 KB Output is correct
14 Incorrect 0 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -