CF1486A.Shifting Stacks

传统题 时间 2000 ms 内存 256 MiB 4 尝试 1 已通过 1 标签

Shifting Stacks

You have nn stacks of blocks. The ii-th stack contains hih_i blocks and it's height is the number of blocks in it. In one move you can take a block from the ii-th stack (if there is at least one block) and put it to the i+1i + 1-th stack. Can you make the sequence of heights strictly increasing?

Note that the number of stacks always remains nn: stacks don't disappear when they have 00 blocks.

Input

First line contains a single integer tt (1t104)(1 \leq t \leq 10^4) — the number of test cases.

The first line of each test case contains a single integer nn (1n100)(1 \leq n \leq 100). The second line of each test case contains nn integers hih_i (0hi109)(0 \leq h_i \leq 10^9) — starting heights of the stacks.

It's guaranteed that the sum of all nn does not exceed 10410^4.

Output

For each test case output YES if you can make the sequence of heights strictly increasing and NO otherwise.

You may print each letter in any case (for example, YES, Yes, yes, yEs will all be recognized as positive answer).

Note

In the first test case there is no need to make any moves, the sequence of heights is already increasing.

In the second test case we need to move one block from the first stack to the second. Then the heights become 00 11.

In the third test case we could move one block from the first stack to the second and then from the second to the third, which would make the heights 33 44 55.

In the fourth test case we can't make a move, but the sequence is not increasing, so the answer is NO.

In the fifth test case we can only make one move (from the second to the third stack), which would make the heights 00 00 11. Both 00 11 00 and 00 00 11 are not increasing sequences, so the answer is NO.

Samples

6
2
1 2
2
1 0
3
4 4 4
2
0 0
3
0 1 0
4
1000000000 1000000000 1000000000 1000000000
YES
YES
YES
NO
NO
YES

在线编程 IDE

建议全屏模式获得最佳体验