Submission #746018

# Submission time Handle Problem Language Result Execution time Memory
746018 2023-05-21T10:36:52 Z vjudge1 Kitchen (BOI19_kitchen) C++14
0 / 100
65 ms 332 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" << endl;
            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 1 ms 324 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 1 ms 324 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 34 ms 320 KB Output is correct
2 Correct 27 ms 332 KB Output is correct
3 Correct 49 ms 316 KB Output is correct
4 Correct 65 ms 320 KB Output is correct
5 Incorrect 56 ms 212 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 1 ms 324 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 -