답안 #465422

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
465422 2021-08-16T02:22:25 Z bonopo Kitchen (BOI19_kitchen) C++14
21 / 100
9 ms 460 KB
#include <bits/stdc++.h>
using namespace std;
#define el "\n"

typedef long long ll;
const int MM = 1e5+5, MOD = 1e9+7;
int N, M, K, wst = 1e9, sum, dp[MM];

int main() {
    cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false);
    cin >> N >> M >> K;
    for(int i = 1, x; i <= N; i++) cin >> x, wst = min(wst, x), sum += x;
    if(wst < K) { cout << "Impossible" << el; return 0; }
    for(int i = 1, x, s = 0; i <= M; i++) {
        cin >> x; s += x;
        for(int j = s; j >= 0; j--) {
            dp[j+x] = max(dp[j+x], dp[j] + min(x, N)); }
    } for(int i = sum; i < MM; i++) if(dp[i] >= N*K) { cout << i - sum << el; return 0; }
    cout << "Impossible" << el;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -