308228: CF1486A. Shifting Stacks
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Shifting Stacks
题意翻译
你有 $n$ 个数,第 $i$ 个数是 $h_i$。你可以对它们做不限量的操作,每一次操作你可以选一个数 $h_j$,让 $h_j$ 减 $1$,$h_{j+1}$ 加 $1$,问能否让这个序列变成一个严格递增的序列。题目描述
You have $ n $ stacks of blocks. The $ i $ -th stack contains $ h_i $ blocks and it's height is the number of blocks in it. In one move you can take a block from the $ i $ -th stack (if there is at least one block) and put it to the $ i + 1 $ -th stack. Can you make the sequence of heights strictly increasing? Note that the number of stacks always remains $ n $ : stacks don't disappear when they have $ 0 $ blocks.输入输出格式
输入格式
First line contains a single integer $ t $ $ (1 \leq t \leq 10^4) $ — the number of test cases. The first line of each test case contains a single integer $ n $ $ (1 \leq n \leq 100) $ . The second line of each test case contains $ n $ integers $ h_i $ $ (0 \leq h_i \leq 10^9) $ — starting heights of the stacks. It's guaranteed that the sum of all $ n $ does not exceed $ 10^4 $ .
输出格式
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).
输入输出样例
输入样例 #1
6
2
1 2
2
1 0
3
4 4 4
2
0 0
3
0 1 0
4
1000000000 1000000000 1000000000 1000000000
输出样例 #1
YES
YES
YES
NO
NO
YES