This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |