Submission #646186

#TimeUsernameProblemLanguageResultExecution timeMemory
646186berrKitchen (BOI19_kitchen)C++17
0 / 100
1 ms320 KiB
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, m, k, ans=0,flag=1, ans2=0; cin>>n>>m>>k; vector<int> a(n), b(m), c(n); for(int i=0; i<n; i++) cin>>a[i], c[i]=a[i]; for(int i=0; i<m; i++) cin>>b[i]; for(int i=0; i<m; i++) { for(int l=0; l<n; l++) { if(a[l]>c[l]-k&&b[i]>0) b[i]--, a[l]--; if(a[l]<0) flag=0; } ans+=b[i]; } for(int i=0; i<n; i++) { if(a[i]!=c[i]-k) flag=0; ans2+=a[i]; } if(ans2>ans) flag=0; if(flag) cout<<ans-ans2; else cout<<"Impossible"; }
#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...