Submission #646186

# Submission time Handle Problem Language Result Execution time Memory
646186 2022-09-29T05:57:36 Z berr Kitchen (BOI19_kitchen) C++17
0 / 100
1 ms 320 KB
#include <bits/stdc++.h>
using namespace std;


int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, m, k, ans=0,flag=1, ans2=0; cin>>n>>m>>k;
    vector<int> a(n), b(m), c(n);

    for(int i=0; i<n; i++) cin>>a[i], c[i]=a[i];
    for(int i=0; i<m; i++) cin>>b[i];

    for(int i=0; i<m; i++)
    {
        for(int l=0; l<n; l++)
        {
            if(a[l]>c[l]-k&&b[i]>0) b[i]--, a[l]--; 
            if(a[l]<0) flag=0;
        }

        ans+=b[i];
    }



    for(int i=0; i<n; i++)
    {
        if(a[i]!=c[i]-k) flag=0;
        ans2+=a[i];
    }   

    if(ans2>ans) flag=0;

    if(flag) cout<<ans-ans2;
    else 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 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 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 -