AtCoder Regular Contest 135
B
Sum of Three Terms
AtCoder
⌀ 1239
原题
← AC →
翻译中…

Problem Statement

翻译中…

You are given a sequence of $N$ integers $S = (S_1, \ldots, S_N)$. Determine whether there is a sequence of $N+2$ integers $A = (A_1, \ldots, A_{N+2})$ that satisfies the conditions below.

翻译中…
  • $0\leq A_i$ for every $i$ ($1\leq i\leq N+2$).
  • $S_i = A_{i} + A_{i+1} + A_{i+2}$ for every $i$ ($1\leq i\leq N$).
翻译中…

If it exists, print one such sequence.

翻译中…

Constraints

翻译中…
  • $1\leq N\leq 3\times 10^5$
  • $0\leq S_i\leq 10^9$
翻译中…

Input

翻译中…

Input is given from Standard Input from the following format:

翻译中…

N
S_1 \ldots S_N

翻译中…

Output

翻译中…

If there is a sequence $A$ that satisfies the conditions, print Yes; otherwise, print No. In the case of Yes, print an additional line containing the elements of such a sequence $A$, separated by spaces.

翻译中…

A_1 \ldots A_{N+2}

翻译中…

If there are multiple sequences satisfying the conditions, you may print any of them.

翻译中…

样例

Input #1
5
6 9 6 6 5
Output #1
Yes
0 4 2 3 1 2 2
We can verify that $S_i = A_i + A_{i+1} + A_{i+2}$ for every $i$ ($1\leq i\leq N$), as follows. - $6 = 0 + 4 + 2$. - $9 = 4 + 2 + 3$. - $6 = 2 + 3 + 1$. - $6 = 3 + 1 + 2$. - $5 = 1 + 2 + 2$.
Input #2
5
0 1 2 1 0
Output #2
No
Input #3
1
10
Output #3
Yes
0 0 10
题目信息
题号
arc135_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。