#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define debug(x) cout<<#x<<": "<<x<<"\n"
int n,i,x,y,b[1000005],p[1000005],u[1000005];
pair<int,int> ans[1000005];
signed main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// freopen("input.000","r",stdin);
// freopen("output.000","w",stdout);
// srand((unsigned)time(NULL));
// rand()
cin>>n;
for (i=1;i<n+1;i++) cin>>b[i];
for (i=1;i<n;i++) cin>>p[i];
for (i=1;i<n;i++) cin>>u[i];
for (i=1;i<n;i++)
{
ans[i].fi=min(b[i],p[i]);
ans[i].se=p[i]-ans[i].fi;
if (ans[i].se>b[i+1])
{
cout<<"NO";return 0;
}
b[i+1] -= ans[i].se;
}
cout<<"YES\n0";
for (i=1;i<n;i++) cout<<"\n"<<ans[i].fi<<" 0 "<<ans[i].se;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
198 ms |
23740 KB |
Output is correct |
5 |
Correct |
254 ms |
23748 KB |
Output is correct |
6 |
Correct |
207 ms |
39372 KB |
Output is correct |
7 |
Correct |
285 ms |
39416 KB |
Output is correct |
8 |
Correct |
3 ms |
596 KB |
Output is correct |
9 |
Correct |
2 ms |
468 KB |
Output is correct |
10 |
Correct |
315 ms |
45468 KB |
Output is correct |
11 |
Correct |
344 ms |
47020 KB |
Output is correct |
12 |
Correct |
459 ms |
59124 KB |
Output is correct |
13 |
Correct |
425 ms |
53444 KB |
Output is correct |
14 |
Correct |
286 ms |
23704 KB |
Output is correct |
15 |
Correct |
411 ms |
61032 KB |
Output is correct |
16 |
Correct |
459 ms |
61104 KB |
Output is correct |
17 |
Correct |
411 ms |
61032 KB |
Output is correct |
18 |
Correct |
422 ms |
61116 KB |
Output is correct |
19 |
Correct |
437 ms |
61100 KB |
Output is correct |
20 |
Correct |
408 ms |
60952 KB |
Output is correct |
21 |
Correct |
403 ms |
60876 KB |
Output is correct |
22 |
Correct |
417 ms |
58320 KB |
Output is correct |
23 |
Correct |
421 ms |
61132 KB |
Output is correct |
24 |
Correct |
493 ms |
74364 KB |
Output is correct |
25 |
Correct |
300 ms |
37292 KB |
Output is correct |
26 |
Correct |
294 ms |
29804 KB |
Output is correct |
27 |
Correct |
463 ms |
66828 KB |
Output is correct |
28 |
Correct |
444 ms |
68620 KB |
Output is correct |
29 |
Correct |
425 ms |
73936 KB |
Output is correct |
30 |
Correct |
484 ms |
80792 KB |
Output is correct |
31 |
Correct |
411 ms |
79756 KB |
Output is correct |
32 |
Correct |
483 ms |
80796 KB |
Output is correct |
33 |
Correct |
247 ms |
38100 KB |
Output is correct |
34 |
Correct |
264 ms |
32772 KB |
Output is correct |
35 |
Correct |
365 ms |
38872 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
198 ms |
23740 KB |
Output is correct |
5 |
Correct |
254 ms |
23748 KB |
Output is correct |
6 |
Correct |
207 ms |
39372 KB |
Output is correct |
7 |
Correct |
285 ms |
39416 KB |
Output is correct |
8 |
Correct |
3 ms |
596 KB |
Output is correct |
9 |
Correct |
2 ms |
468 KB |
Output is correct |
10 |
Correct |
315 ms |
45468 KB |
Output is correct |
11 |
Correct |
344 ms |
47020 KB |
Output is correct |
12 |
Correct |
459 ms |
59124 KB |
Output is correct |
13 |
Correct |
425 ms |
53444 KB |
Output is correct |
14 |
Correct |
286 ms |
23704 KB |
Output is correct |
15 |
Correct |
411 ms |
61032 KB |
Output is correct |
16 |
Correct |
459 ms |
61104 KB |
Output is correct |
17 |
Correct |
411 ms |
61032 KB |
Output is correct |
18 |
Correct |
422 ms |
61116 KB |
Output is correct |
19 |
Correct |
437 ms |
61100 KB |
Output is correct |
20 |
Correct |
408 ms |
60952 KB |
Output is correct |
21 |
Correct |
403 ms |
60876 KB |
Output is correct |
22 |
Correct |
417 ms |
58320 KB |
Output is correct |
23 |
Correct |
421 ms |
61132 KB |
Output is correct |
24 |
Correct |
493 ms |
74364 KB |
Output is correct |
25 |
Correct |
300 ms |
37292 KB |
Output is correct |
26 |
Correct |
294 ms |
29804 KB |
Output is correct |
27 |
Correct |
463 ms |
66828 KB |
Output is correct |
28 |
Correct |
444 ms |
68620 KB |
Output is correct |
29 |
Correct |
425 ms |
73936 KB |
Output is correct |
30 |
Correct |
484 ms |
80792 KB |
Output is correct |
31 |
Correct |
411 ms |
79756 KB |
Output is correct |
32 |
Correct |
483 ms |
80796 KB |
Output is correct |
33 |
Correct |
247 ms |
38100 KB |
Output is correct |
34 |
Correct |
264 ms |
32772 KB |
Output is correct |
35 |
Correct |
365 ms |
38872 KB |
Output is correct |
36 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
37 |
Halted |
0 ms |
0 KB |
- |