Submission #596322

# Submission time Handle Problem Language Result Execution time Memory
596322 2022-07-14T15:18:33 Z AlesL0 Kitchen (BOI19_kitchen) C++17
0 / 100
6 ms 468 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){
    ll n, m, k; cin >> n >> m >> k;
    vector <ll> a(n), b(n);
    ll flag = m, sum = 0; 
    for (int i = 0; i < n; i++){
        cin >> a[i];
        flag = min(flag, a[i]);
        sum += a[i];
    }
    if (flag < k){
        cout << "impossible";
        return 0;
    }
    for (int i = 0; i < m; i++)cin >> b[i];
    vector<ll> dp(9001, -10000);
    dp[0] = 0;
    for (int i = 0; i < m; i++){
        for (int j = 9000-b[i]; j >= 0; j--)dp[j+b[i]] = max(dp[j+b[i]], dp[j]+min(n, b[i]));
    }
    for (int i = sum; i <= 9000; i++){
        if (dp[i] >= n*k){
            cout << i-sum;
            return 0;
        }
    }
    cout << "impossible";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -