Submission #569165

# Submission time Handle Problem Language Result Execution time Memory
569165 2022-05-26T20:40:50 Z Uzouf Kitchen (BOI19_kitchen) C++14
0 / 100
24 ms 980 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl "\n"
int mod=1e9+7;
const int N=2e5+5;
template<class x>
using ordered_multiset = tree<x, null_type,less_equal<x>, rb_tree_tag,tree_order_statistics_node_update>;

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen(".in", "r", stdin); freopen(".out", "w", stdout);

    int n,m,k; cin>>n>>m>>k;
    int a[n],b[m];
    int suma=0;
    bool bl=true;
    for (int &i:a) {
      cin>>i;
      if (i<k || m<k) bl=false;
      suma+=i;
    }
    for (int &i:b) cin>>i;

    if (!bl) {
      cout<<"Impossible"; return 0;
    }

    int dp[90005];
    for (int i=0;i<=90000;i++) dp[i]=-1e18;

    for (int i=0;i<m;i++) {
      for (int j=90000;j>=b[i];j--) {
        dp[j]=max(dp[j],dp[j-b[i]]+min(n,b[i]));
      }
    }

    for (int i=suma;i<=90000;i++) {
      if (dp[i]>=k*n) {
        cout<<i-suma; return 0;
      }
    }

    cout<<"Impossible";

}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 980 KB Output isn't correct
2 Halted 0 ms 0 KB -