F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Cute Tree

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 580    Accepted Submission(s): 340


Problem Description
Given the pseudo-code of a function $Build-Tree(A,id,L,R)$:



where $A$ is given in input, $id$ is the number of node, $L$ ,$R$ is the left position and the right position of $A$

Require the number of nodes created by $Build-Tree(A,root,1,n)$.
 

Input
The first line contains an integer $T$ $(1\leq T\leq 5)$ representing the number of test cases.

For each test case, the first contain one integer $n(1 \le n \le 2*10^5)$.

The second line contain n integers $A_i$$(1 \le A_i \le 10^9)$.

 

Output
For each test output one line, the number of nodes created by $Build-Tree(A,root,1,n)$.
 

Sample Input
样例1: 1 7 4 3 5 2 6 7 1 样例2: 2 4 2 2 5 3 10 21 10 5 89 12 3 42 13 55 76
 

Sample Output
样例1: 11 样例2: 6 15
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 08:02:28, Gzip enabled