답안 #746034

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
746034 2023-05-21T10:41:01 Z vjudge1 Kitchen (BOI19_kitchen) C++14
20 / 100
62 ms 316 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, allH = 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;
        allH += x;
    }
    if (allH < requiredHours) {
        cout << "Impossible" << endl;
        return 0;
    }

    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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 312 KB Output is correct
2 Correct 27 ms 212 KB Output is correct
3 Correct 48 ms 316 KB Output is correct
4 Correct 62 ms 316 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 33 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -