Submission #746016

# Submission time Handle Problem Language Result Execution time Memory
746016 2023-05-21T10:35:26 Z vjudge1 Kitchen (BOI19_kitchen) C++14
0 / 100
54 ms 336 KB
#include <bits/stdc++.h>

using namespace std;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n, m, k, requiredHours = 0;
    cin >> n >> m >> k;
    
    vector<int> meals(n), chefs(m);

    for (int & x : meals) {
        cin >> x;
        if (x < k){
            cout << "Impossible" << '\n';
            return 0;
        }
        requiredHours += x;
    }
    for (int & x : chefs) cin >> x;

    vector<bool> snack(300*300+1, false);
    snack[0] = true;
    for (int i = 0; i < m; i++){
        for (int j = 300*300; j >= 0; j--){
            if (snack[j]) snack[j + chefs[i]] = true;
        }
    }

    int mo = requiredHours;
    while(true){
        if (snack[mo]) break;
        mo++;
    }
    cout << mo - requiredHours << endl;




    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 336 KB Output is correct
2 Correct 21 ms 328 KB Output is correct
3 Correct 43 ms 212 KB Output is correct
4 Correct 54 ms 212 KB Output is correct
5 Incorrect 46 ms 312 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -