Submission #762715

# Submission time Handle Problem Language Result Execution time Memory
762715 2023-06-21T16:43:54 Z zsombor Kitchen (BOI19_kitchen) C++17
100 / 100
50 ms 716 KB
#include <iostream>
#include <vector>
using namespace std;

int n, m, k, a, sum = 0;
vector <int> ks(1e5 + 1, -1e9);

int main()
{
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++) {
        cin >> a;
        sum += a;
        if (a < k) { cout << "Impossible"; return 0; }
    }

    ks[0] = 0;
    for (int i = 0; i < m; i++) {
        cin >> a;
        for (int j = 1e5; j >= a; j--) {
            ks[j] = max(ks[j], ks[j - a] + min(a, n));
        }
    }

    for (int i = sum; i <= 1e5; i++) {
        if (ks[i] < n * k) continue;
        cout << i - sum;
        return 0;
    }
    cout << "Impossible";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 708 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 708 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 3 ms 704 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 3 ms 716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 596 KB Output is correct
2 Correct 37 ms 596 KB Output is correct
3 Correct 36 ms 680 KB Output is correct
4 Correct 50 ms 596 KB Output is correct
5 Correct 35 ms 596 KB Output is correct
6 Correct 31 ms 680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 596 KB Output is correct
2 Correct 6 ms 700 KB Output is correct
3 Correct 5 ms 596 KB Output is correct
4 Correct 6 ms 596 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 708 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 3 ms 704 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 3 ms 716 KB Output is correct
14 Correct 32 ms 596 KB Output is correct
15 Correct 37 ms 596 KB Output is correct
16 Correct 36 ms 680 KB Output is correct
17 Correct 50 ms 596 KB Output is correct
18 Correct 35 ms 596 KB Output is correct
19 Correct 31 ms 680 KB Output is correct
20 Correct 6 ms 596 KB Output is correct
21 Correct 6 ms 700 KB Output is correct
22 Correct 5 ms 596 KB Output is correct
23 Correct 6 ms 596 KB Output is correct
24 Correct 1 ms 596 KB Output is correct
25 Correct 26 ms 596 KB Output is correct
26 Correct 30 ms 596 KB Output is correct
27 Correct 20 ms 688 KB Output is correct
28 Correct 31 ms 696 KB Output is correct
29 Correct 33 ms 688 KB Output is correct
30 Correct 46 ms 680 KB Output is correct