#P7034. Array
Array
Problem Description
Koishi gives you an array $B$ of length $n$ satisfying $1 \leq B_1 \leq B_2 \leq \cdots \leq B_n \leq n+1$.
Let $S(T)$ denote the set of numbers that appear in array $T$. She asks you whether an array $A$ of length $n$ exists so that for any $l, r(1 \leq l \leq r \leq n)$, $S(A[l,r])=S(A[1,n])$ holds if and only if $r \ge B_l$.
$A[l,r]$ represents the sub-array of $A$ formed by $A_l, A_{l+1}, \cdots, A_{r}$.
Notice: If there exists a $i(1\leq i\leq n)$, that $B_i<i$ holds, the required $A$ must not exist.
Input
The first line contains an integer $T(1 \leq T \leq 3 \times 10^4)$ - the number of test cases. Then $T$ test cases follow.
The first line of each test case contains an integer $n(1\leq n \leq 2 \times 10^5)$ - the length of array $B$ (and $A$).
The next line contains $n$ integers $B_1, B_2, \cdots, B_n(1\leq B_1\leq B_2......\leq B_n\leq n+1)$ - the array that Koishi gives you.
It is guaranteed that $\sum n \leq 4.5 \times 10^6$.
Output
For each test case, output "YES" if the array $A$ exists, or "NO" otherwise.
3
4
3 3 5 5
7
4 6 6 7 8 8 8
5
2 3 4 4 6
YES
YES
NO