Submission #567132

# Submission time Handle Problem Language Result Execution time Memory
567132 2022-05-23T08:19:32 Z Majid Kitchen (BOI19_kitchen) C++17
0 / 100
1 ms 212 KB
#include<bits/stdc++.h>
using namespace std;
 
//Types
using ll = long long;
using db = double;
 
//Vectors
#define pb push_back
#define sz(vec) ((ll)vec.size())
#define all(vec) vec.begin(), vec.end()
 
//things
#define f first
#define s second
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void solve(){

    ll n, m, k, sum = 0, sum2 = 0;
    cin>>n>>m>>k;
    
    bool imp = false;
    
    if(m<k)imp = true;
    vector<ll> vec(n), hr(m);
    
    for(ll i = 0; i < n; i++){
        
        cin>>vec[i];
        sum+=vec[i];
        if(vec[i]<k)imp = true;
    }
    
    for(ll i = 0; i < m; i++){
        
        cin>>hr[i];
        sum2+=hr[i];
    }
    
    if(sum>sum2)imp = true;
    
    
    // 5 5 5 
    // 
    // 14 1
    
    if(m==2){
        
        if(hr[0]<n or hr[1]<n)imp = true;
        
    }
    
    if(!imp){
        
        if(m==2)cout<<(hr[0] + hr[1]) - sum;
        else{
            
            if(k==1){
                
                cout<<sum2 - sum;
            }
        }
    }
    
    else cout<<"Impossible";
    
}


int main(){
	Speeed
	
    ll t=1;
    // cin>>t;
    
    while(t--){
        
        solve();
    }
}
# 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 Incorrect 0 ms 212 KB Output isn't correct
2 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 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -