Submission #1099270

# Submission time Handle Problem Language Result Execution time Memory
1099270 2024-10-11T03:59:00 Z vjudge1 Kitchen (BOI19_kitchen) C++17
0 / 100
69 ms 107604 KB
#include <bits/stdc++.h>
#define ll int
using namespace std;
#define bit(x,y) ((x >> y) & 1)
const ll mod = 1e9 + 7;
const ll inf = INT_MIN/2;
ll d[305][305 * 305];
ll a[305],b[305];
int main()
{
    ll n,m,k;
    cin >> n >> m >> k;
    ll i,j;
    ll s = 0;
    for(i = 1;i <= n;i++)
    {
        cin >> a[i];
        s += a[i];
    }
    for(i = 1;i <= m;i++) cin >> b[i];
    for(i = 0;i <= 300;i++)
    {
        for(j = 0;j <= 300 * 300;j++)
        {
            d[i][j] = inf;
        }
    }
    d[0][0] = 0;
    for(i = 1;i <= m;i++)
    {
        for(j = 0;j <= 300 * 300;j++)
        {
            if(d[i - 1][j] == inf) continue;
            d[i][j] = max(d[i][j],d[i - 1][j]);
            if(j + b[i] <= 300 * 300) d[i][j + b[i]] = max(d[i][j + b[i]],d[i - 1][j] + min(b[i],n));
        }
    }
    ll ans = -1;
    for(i = s;i <= 300 * 300;i++)
    {
        if(d[m][i] >= n * k) ans = i - s;
    }
    if(ans == -1) cout << "Impossible";
    else cout << ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 107588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 107588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 107604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 107604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 107588 KB Output isn't correct
2 Halted 0 ms 0 KB -