답안 #745765

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
745765 2023-05-21T07:29:08 Z vjudge1 Kitchen (BOI19_kitchen) C++17
0 / 100
1 ms 224 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long int;

const ll mod = 1e9 + 7;


int main(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<ll> v(n), t(m);
    for(auto& i : v){
        cin >> i;
    }
    for(auto& i : t){
        cin >> i;
    }
    if(m < k || *min_element(begin(v), end(v)) < k){
        cout << "impossible" << endl;
        return 0;
    }
    int sumv = 0;
    for(auto& i : v){
        sumv += i;
    }
    int sumt = 0;
    for(auto& i : t){
        sumt += i;
    }
    if(sumt < sumv){
        cout << "impossible" << endl;
        return 0;
    }
    if(m == k){
        cout << sumt - sumv << endl;
        return 0;
    }
    else{
        int lossa = t[0] - sumv, lossb = t[1] - sumv;
        if(lossa > 0 && lossb > 0){
            cout << min(lossa, lossb) << endl;
            return 0;
        }
        if(lossa > 0){
            cout << lossa << endl;
            return 0;
        }
        if(lossb > 0){
            cout << lossb << endl;
            return 0;
        }
        else{
            cout << sumt - sumv << endl;
            return 0;
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 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 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 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 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 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 224 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 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -