Submission #711125

#TimeUsernameProblemLanguageResultExecution timeMemory
711125safaricolaRainy Markets (CCO22_day1problem2)C++17
0 / 25
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 1; i <= n; i++) #define ii pair<int,int> #define f first #define s second #define pb push_back #define debug(x) cout<<#x<<' '<<x<<endl; int n, a[1000010],b[1000010],c[1000010],ans[1000010][3]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); cin>>n; rep(i,n)cin>>a[i]; rep(i,n-1)cin>>b[i]; rep(i,n-1)cin>>c[i]; rep(i,n-1){ ans[i][0]=min(a[i],b[i]); b[i]-=ans[i][0]; if(b[i]>0){ a[i+1]-=b[i]; if(a[i+1]<0){ cout<<"NO"; return 0; } ans[i][2]=b[i]; } } cout<<"YES\n"; rep(i,n-1){ cout<<ans[i][0]<<' '<<ans[i][1]<<' '<<ans[i][2]<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...