Problem Statement
A sequence of positive integers $T=(T_1,T_2,\dots,T_M)$ of length $M$ is a palindrome if and only if $T_i=T_{M-i+1}$ for each $i=1,2,\dots,M$.
You are given a sequence of non-negative integers $A = (A_1,A_2,\dots,A_N)$ of length $N$. Determine if there is a sequence of positive integers $S=(S_1,S_2,\dots,S_N)$ of length $N$ that satisfies the following condition, and if it exists, find the lexicographically smallest such sequence.
- For each
$i=1,2,\dots,N$, both of the following hold: - The sequence
$(S_{i-A_i},S_{i-A_i+1},\dots,S_{i+A_i})$is a palindrome.- If
$2 \leq i-A_i$and$i+A_i \leq N-1$, the sequence$(S_{i-A_i-1},S_{i-A_i},\dots,S_{i+A_i+1})$is not a palindrome.
- If
Constraints
$1 \leq N \leq 2 \times 10^5$$0 \leq A_i \leq \min\{i-1,N-i\}$- All input values are integers.
Input
The input is given from Standard Input in the following format:
N
A_1 A_2 \dots A_N
Output
If there is no sequence $S$ that satisfies the condition, print No.
If there is a sequence $S$ that satisfies the condition, let $S'$ be the lexicographically smallest such sequence and print it in the following format:
Yes
S'_1 S'_2 \dots S'_N
样例
7
0 0 2 0 2 0 0
Yes
1 1 2 1 1 1 2
7
0 1 2 3 2 1 0
Yes
1 1 1 1 1 1 1
7
0 1 2 0 2 1 0
No
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。