답안 #928875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928875 2024-02-17T07:26:52 Z Muhammad_Aneeq Kitchen (BOI19_kitchen) C++17
21 / 100
176 ms 4180 KB
/*
بسم الله الرحمن الرحيم
Author:
                          (:Muhammad Aneeq:)
*/

#include <iostream>
using namespace std;
int const N=300*300*10+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();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3932 KB Output is correct
2 Incorrect 3 ms 3976 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3932 KB Output is correct
2 Incorrect 3 ms 3976 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 176 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 3928 KB Output is correct
2 Correct 28 ms 3932 KB Output is correct
3 Correct 31 ms 3952 KB Output is correct
4 Correct 33 ms 3956 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3932 KB Output is correct
2 Incorrect 3 ms 3976 KB Output isn't correct
3 Halted 0 ms 0 KB -