답안 #745911

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
745911 2023-05-21T09:35:13 Z vjudge1 Kitchen (BOI19_kitchen) C++17
9 / 100
1 ms 212 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;
    }
    if(k == 2 && *min_element(begin(t), end(t)) < 2){
        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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 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 0 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 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Halted 0 ms 0 KB -