Submission #569161

# Submission time Handle Problem Language Result Execution time Memory
569161 2022-05-26T20:37:28 Z Uzouf Kitchen (BOI19_kitchen) C++14
0 / 100
15 ms 704 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[suma+5];
    for (int i=0;i<suma+5;i++) dp[i]=0;
    
    for (int i=0;i<n;i++) {
      for (int j=b[i];j<suma+5;j++) {
        dp[j]=max(dp[j],dp[j-b[i]]+min(n,b[i]));
      }
    }

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

    cout<<"Impossible";

}
# 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 15 ms 704 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 -