답안 #494049

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
494049 2021-12-14T03:33:26 Z SirCovidThe19th Kitchen (BOI19_kitchen) C++17
100 / 100
106 ms 119748 KB
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, x, y) for (int i = x; i < y; i++)

int n, m, k, sm, bad = 0, ans = 1e9, A[305], B[305], dp[305][100005];

int main(){
    cin >> n >> m >> k;
    FOR(i, 1, n + 1) cin >> A[i], sm += A[i], bad |= (A[i] < k);
    FOR(i, 1, m + 1) cin >> B[i];

    memset(dp, -0x3f, sizeof(dp)); dp[0][0] = 0;

    FOR(i, 1, m + 1) FOR(j, 0, 100005){
        dp[i][j] = dp[i - 1][j];
        if (j - B[i] >= 0) dp[i][j] = max(dp[i][j], dp[i - 1][j - B[i]] + min(B[i], n));

        if (j >= sm and dp[i][j] >= n * k) ans = min(ans, j - sm);  
    }
    cout<<((bad or ans == 1e9) ? "Impossible" : to_string(ans))<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 45 ms 119620 KB Output is correct
2 Correct 44 ms 119628 KB Output is correct
3 Correct 45 ms 119644 KB Output is correct
4 Correct 43 ms 119628 KB Output is correct
5 Correct 43 ms 119616 KB Output is correct
6 Correct 44 ms 119584 KB Output is correct
7 Correct 43 ms 119660 KB Output is correct
8 Correct 46 ms 119548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 45 ms 119620 KB Output is correct
2 Correct 44 ms 119628 KB Output is correct
3 Correct 45 ms 119644 KB Output is correct
4 Correct 43 ms 119628 KB Output is correct
5 Correct 43 ms 119616 KB Output is correct
6 Correct 44 ms 119584 KB Output is correct
7 Correct 43 ms 119660 KB Output is correct
8 Correct 46 ms 119548 KB Output is correct
9 Correct 52 ms 119748 KB Output is correct
10 Correct 46 ms 119620 KB Output is correct
11 Correct 46 ms 119620 KB Output is correct
12 Correct 48 ms 119656 KB Output is correct
13 Correct 52 ms 119588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 91 ms 119636 KB Output is correct
2 Correct 83 ms 119656 KB Output is correct
3 Correct 100 ms 119572 KB Output is correct
4 Correct 106 ms 119620 KB Output is correct
5 Correct 99 ms 119572 KB Output is correct
6 Correct 91 ms 119604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 119648 KB Output is correct
2 Correct 48 ms 119540 KB Output is correct
3 Correct 51 ms 119656 KB Output is correct
4 Correct 53 ms 119656 KB Output is correct
5 Correct 52 ms 119620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 45 ms 119620 KB Output is correct
2 Correct 44 ms 119628 KB Output is correct
3 Correct 45 ms 119644 KB Output is correct
4 Correct 43 ms 119628 KB Output is correct
5 Correct 43 ms 119616 KB Output is correct
6 Correct 44 ms 119584 KB Output is correct
7 Correct 43 ms 119660 KB Output is correct
8 Correct 46 ms 119548 KB Output is correct
9 Correct 52 ms 119748 KB Output is correct
10 Correct 46 ms 119620 KB Output is correct
11 Correct 46 ms 119620 KB Output is correct
12 Correct 48 ms 119656 KB Output is correct
13 Correct 52 ms 119588 KB Output is correct
14 Correct 91 ms 119636 KB Output is correct
15 Correct 83 ms 119656 KB Output is correct
16 Correct 100 ms 119572 KB Output is correct
17 Correct 106 ms 119620 KB Output is correct
18 Correct 99 ms 119572 KB Output is correct
19 Correct 91 ms 119604 KB Output is correct
20 Correct 59 ms 119648 KB Output is correct
21 Correct 48 ms 119540 KB Output is correct
22 Correct 51 ms 119656 KB Output is correct
23 Correct 53 ms 119656 KB Output is correct
24 Correct 52 ms 119620 KB Output is correct
25 Correct 79 ms 119608 KB Output is correct
26 Correct 88 ms 119664 KB Output is correct
27 Correct 93 ms 119628 KB Output is correct
28 Correct 86 ms 119656 KB Output is correct
29 Correct 90 ms 119628 KB Output is correct
30 Correct 95 ms 119656 KB Output is correct