답안 #596303

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
596303 2022-07-14T14:57:28 Z AlesL0 Kitchen (BOI19_kitchen) C++17
0 / 100
9 ms 340 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){
    ll n, m, k; cin >> n >> m >> k;
    vector <ll> a(n), b(n);
    ll flag = m, sum = 0; 
    for (int i = 0; i < n; i++){
        cin >> a[i];
        flag = min(flag, a[i]);
        sum += a[i];
    }
    if (flag < k){
        cout << "impossible";
        return 0;
    }
    for (int i = 0; i < m; i++)cin >> b[i];
    vector<ll> dp(9001, -1000);
    dp[0] = 0;
    for (int i = 0; i < m; i++){
        for (int j = 9000-b[i]; j >= 0; j--)dp[j+b[i]] = max(dp[j+b[i]], dp[j]+1);
    }
    for (int i = sum; i <= 9000; i++){
        if (dp[i] >= k){
            cout << i-sum;
            return 0;
        }
    }
    cout << "impossible";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -