Submission #745822

# Submission time Handle Problem Language Result Execution time Memory
745822 2023-05-21T08:21:24 Z vjudge1 Kitchen (BOI19_kitchen) C++17
0 / 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;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 -