All submissions for this problem are available.
Mr. Leonard is hosting a new Gift Hamper round in Kaun Banega Code-pati, a famous coding game. Questions are displayed on the computer which have to be answered and accordingly scores are given. The person playing the round knows only his or her score. All the participants sit in a line and each of them has a rating according to his or her performance. Atleast one gift hamper is granted to all the participants playing this round. Mr. Leonard must give a gift hamper according to their scores, such that, if any adjacent participant's score is higher than the person sitting next to him, the one with the higher score must get more gift hampers than the other. KBC wants to save its money so it wants to give as few gift hampers in total.
The first line of the input contains no. of test cases T followed by integer N, the number of participants in KBC. Each of the following N lines contains an integer indicates the score of each participant.
On the only line of the output print an integer describing the minimum number of gift hampers KBC must give.
Should contain all the constraints on the input data that you may have. Format it like:
- 1 ≤ T ≤ 100
- 1 ≤ n ≤ 100
Input: 2 3 1 2 2 4 1 2 3 2 Output: 4 7
Case 1.The number of gift hampers KBC must give are 1,2 and 1. One gift hamper is gifted to all the 3 participants. When the scores of the 1st and 2nd participants are compared, 2nd participant having a higher score wins a gift hamper. When 2nd and 3rd participants’ scores are compared, both do not win any gift hamper.
|Time Limit:||0.191011 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, 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|
Fetching successful submissions