답안 #745874

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
745874 2023-05-21T09:03:36 Z vjudge1 Kitchen (BOI19_kitchen) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int>a(n), b(m);
    int sum = 0, sum2 = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    for(int i = 0; i < m; i++){
        cin >> b[i];
        sum2 += b[i];
    }
    if(sum2 < sum || m < k){
        cout << "Impossible\n";
        return 0;
    }
    if(k >= 2){
        if(min(b[0], b[1]) < n){
            cout << "Impossible\n";
            return 0;
        }
    }
    if(m == 1){
        cout << sum2 - sum << endl;
        return 0;
    }
    if(min(b[0], b[1]) >= sum){
        cout << min(b[0], b[1]) - sum << endl;
        return 0;
    }
    if(max(b[0], b[1]) >= sum){
        cout << max(b[0], b[1]) - sum << endl;
        return 0;
    }
    cout << b[0] + b[1] - sum << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -