Submission #567132

#TimeUsernameProblemLanguageResultExecution timeMemory
567132MajidKitchen (BOI19_kitchen)C++17
0 / 100
1 ms212 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...