Submission #928874

# Submission time Handle Problem Language Result Execution time Memory
928874 2024-02-17T07:25:50 Z Muhammad_Aneeq Kitchen (BOI19_kitchen) C++17
21 / 100
21 ms 856 KB
/*
بسم الله الرحمن الرحيم
Author:
                          (:Muhammad Aneeq:)
*/

#include <iostream>
using namespace std;
int const N=300*300+10;
int dp[N]={};
inline void solve()
{
    int n,m,k;
    cin>>n>>m>>k;
    int z=0;
    int a[n];
    for (auto& i:a)
    {
        cin>>i,z+=i;
        if (i<k)
        {
            cout<<"Impossible\n";return;
        }
    }
    dp[0]=0;
    for (int i=0;i<m;i++)
    {
        int x;
        cin>>x;
        for (int j=N-x-1;j>=0;j--)
            dp[j+x]=max(dp[j+x],dp[j]+min(x,n));
    }
    for (int i=z;i<N;i++)
    {
        if (dp[i]>=k*n)
        {
            cout<<i-z<<'\n';
            return;
        }
    }
    cout<<"Impossible\n";
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Incorrect 1 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Incorrect 1 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 856 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Incorrect 1 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -