Submission #428264

# Submission time Handle Problem Language Result Execution time Memory
428264 2021-06-15T09:16:53 Z schse Kitchen (BOI19_kitchen) C++17
0 / 100
2 ms 460 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    vector<int> recipes(N), chefs(M);
    for (int &i : recipes)
        cin >> i;
    for (int &i : chefs)
        cin >> i;

    int totalwork = accumulate(recipes.begin(), recipes.end(), 0);
    int totalchefs = accumulate(chefs.begin(), chefs.end(), 0);

    if (K > M || totalchefs < totalwork)
        cout << "Impossible\n";
    else if (M == 1 && K == 1)
        cout << chefs[0] - totalwork;
    else if (M == 2 && K == 1)
    {
        if (min(chefs[0], chefs[1]) >= totalwork)
            cout << min(chefs[0], chefs[1]) - totalwork;
        else if (max(chefs[0], chefs[1]) >= totalwork)
            cout << max(chefs[0], chefs[1]) - totalwork;
        else
            cout << chefs[0]+chefs[1] - totalwork;
    }
    else if (M == 2 && K == 2)
    {
        if (min(chefs[0], chefs[1]) < N)
            cout << "Impossible\n";
        else
            cout << chefs[0]+chefs[1] - totalwork;
    }
    else
        assert(false);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 460 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -