답안 #858327

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
858327 2023-10-08T06:25:18 Z Trisanu_Das Kitchen (BOI19_kitchen) C++17
100 / 100
38 ms 856 KB
#include <bits/stdc++.h>
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\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 3 ms 832 KB Output is correct
13 Correct 3 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 816 KB Output is correct
2 Correct 27 ms 604 KB Output is correct
3 Correct 37 ms 812 KB Output is correct
4 Correct 38 ms 816 KB Output is correct
5 Correct 35 ms 604 KB Output is correct
6 Correct 25 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 856 KB Output is correct
2 Correct 5 ms 832 KB Output is correct
3 Correct 5 ms 856 KB Output is correct
4 Correct 5 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 3 ms 832 KB Output is correct
13 Correct 3 ms 604 KB Output is correct
14 Correct 32 ms 816 KB Output is correct
15 Correct 27 ms 604 KB Output is correct
16 Correct 37 ms 812 KB Output is correct
17 Correct 38 ms 816 KB Output is correct
18 Correct 35 ms 604 KB Output is correct
19 Correct 25 ms 604 KB Output is correct
20 Correct 7 ms 856 KB Output is correct
21 Correct 5 ms 832 KB Output is correct
22 Correct 5 ms 856 KB Output is correct
23 Correct 5 ms 604 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 25 ms 600 KB Output is correct
26 Correct 30 ms 816 KB Output is correct
27 Correct 19 ms 604 KB Output is correct
28 Correct 29 ms 840 KB Output is correct
29 Correct 30 ms 604 KB Output is correct
30 Correct 36 ms 804 KB Output is correct