Submission #596375

# Submission time Handle Problem Language Result Execution time Memory
596375 2022-07-14T16:06:11 Z AlesL0 Kitchen (BOI19_kitchen) C++17
0 / 100
9 ms 340 KB
#include <bits/stdc++.h>

using namespace std;

mt19937 rng(time(nullptr));

int main(){

    int n, m, k; cin >> n >> m >> k;
    vector <int> a(n), b(n);
    int flag = m, sum = 0; 
    for (int i = 0; i < n; i++){
        cin >> a[i];
        flag = min(flag, a[i]);
        sum += a[i];
    }
    for (int i = 0; i < m; i++)cin >> b[i];
    if (flag < k){
        cout << "impossible";
        return 0;
    }
    vector <int> dp(9001, -100000);
    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 = 0; i+sum <= 9000; i++){
        if (dp[i+sum] >= n*k){
            cout << i;
            return 0;
        }
    }
    cout << "impossible";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 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 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 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 9 ms 332 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 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -