#C1427. Count Visible Trees

    ID: 43900 Type: Default 1000ms 256MiB

Count Visible Trees

Count Visible Trees

You are given a forest represented as a sequence of trees where each tree has an associated height. A tree is visible if it is strictly taller than all the trees before it in that sequence. Your task is to determine the number of visible trees for each test case.

Formally, given an array of heights \(h_1, h_2, \dots, h_n\), a tree at position \(i\) is visible if and only if \(h_i > \max\{h_1, h_2, \dots, h_{i-1}\}\) (with the convention that the maximum of an empty set is \(-\infty\)).

You need to process multiple test cases.

inputFormat

The first line contains a single integer \(T\) (\(1 \le T \le 10\)), the number of test cases.

For each test case, the first line contains a single integer \(N\) (\(1 \le N \le 10^5\)), the number of trees. The second line contains \(N\) space-separated integers representing the heights of the trees.

The input is read from standard input (stdin).

outputFormat

For each test case, output a single line containing one integer — the number of visible trees in the test case. The answer for each test case should be printed on its own line to standard output (stdout).

## sample
1
4
2 3 4 1
3

</p>