Walk

All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
Chef and his girlfriend are going to have a promenade. They are walking along the straight road which consists of segments placed one by one. Before walking Chef and his girlfriend stay at the beginning of the first segment, they want to achieve the end of the last segment.
There are few problems:
 At the beginning Chef should choose constant integer  the velocity of mooving. It can't be changed inside one segment.
 The velocity should be decreased by at least 1 after achieving the end of some segment.
 There is exactly one shop on each segment. Each shop has an attractiveness. If it's attractiveness is W and Chef and his girlfriend move with velocity V then if V < W girlfriend will run away into the shop and the promenade will become ruined.
Chef doesn't want to lose her girl in such a way, but he is an old one, so you should find the minimal possible velocity at the first segment to satisfy all conditions.
Input
 The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
 The first line of each test case contains a single integer N denoting the number of segments. The second line contains N spaceseparated integers W_{1}, W_{2}, ..., W_{N} denoting the attractiveness of shops.
Output
 For each test case, output a single line containing the minimal possible velocity at the beginning.
Constraints
 1 ≤ T ≤ 10
 1 ≤ N ≤ 10^5
 1 ≤ W_{i} ≤ 10^6
Example
Input: 2 5 6 5 4 3 2 5 3 4 3 1 1 Output: 6 5
Explanation
Example case 1.
If we choose velocity 6, on the first step we have 6 >= 6 everything is OK, then we should decrease the velocity to 5 and on the 2nd segment we'll receive 5 >= 5, again OK, and so on.
Example case 2.
If we choose velocity 4, the promanade will be ruined on the 2nd step (we sould decrease our velocity, so the maximal possible will be 3 which is less than 4).
Author:  berezin 
Tester:  whiteking 
Editorial  http://discuss.codechef.com/problems/WALK 
Tags  berezin, cakewalk, march14, programming 
Date Added:  21012014 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions