KURUK14 - GENIE SEQUENCE

no tags 

A Genie Sequence is a sequence in which every element indicates the number of elements present before or after it. Given an array of numbers, find whether you can form a Genie sequence or not.

Input

First line contains a single integer T, the number of test cases. It is followed by T cases each of which contains two lines. First line of each test case contains a single integer N. The next line contains N integers separated by a single space.

Output

For each test case output a single line containing "YES" (without quotes) if it is possible to form a genie sequence or "NO" (without quotes) if it is not possible.

Constraints

1 <= T <= 20

2 <= N <= 1000

1 <= ai <= 1000

Example

Input:
1
4
1 3 3 2

Output:
YES

Explanation for the test case:

The Genie sequence is {3, 1, 2, 3}. The first element '3' in the sequence indicates that three numbers are after it, the 2nd element '1' indicates that one number if before it, the 3rd element '2' indicates that two elements are before it and the last element indicates that three elements are before it. So the answer is YES.


hide comments
Divyank Duvedi: 2014-05-23 20:36:55

Easy...A/C in one go!!

sawan mahajan: 2014-05-15 06:54:37

want some test cases

Hector Monteo: 2014-05-11 04:31:36

easy!

innovolt: 2014-03-03 16:48:13

easy1

Chandan Mittal: 2014-02-19 22:53:34

easy 1 but it was hard time testing this program

JordanBelfort: 2014-02-09 11:34:42

easy

Abhishek Gupta: 2014-02-07 08:40:25

my 100th classical :)

anurag garg: 2014-02-06 11:19:04

easy.....but took 1 hour to implement

yvn: 2014-02-05 15:55:07

nice problem

Amit Kumar: 2014-02-04 12:49:25

@saif I think no as value of a can not be 0.


Added by:785227
Date:2014-01-31
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C CSHARP C++ 4.3.2 CPP C99 JAVA PERL PYTHON PYTHON3
Resource:Kurukshetra Onsite Programming Contest