#C8365. Max Buildings with Sunlight

    ID: 52339 Type: Default 1000ms 256MiB

Max Buildings with Sunlight

Max Buildings with Sunlight

You are given a series of test cases. In each test case, you are given a sequence of n building heights. A building has a direct line of sight to the sun if it is strictly taller than all the buildings before it. In other words, if the heights of the buildings are represented by \(h_1, h_2, \dots, h_n\), then building \(i\) can see the sun if and only if \(h_i > \max\{h_1, h_2, \dots, h_{i-1}\}\). The task is to determine the number of buildings that can see the sun for each test case.

Input Formula: The problem input begins with a positive integer T representing the number of test cases. For each test case, the first line contains a single positive integer n (the number of buildings), followed by a line containing n space-separated integers \(h_1, h_2, \dots, h_n\). The output for each test case should be a single integer that denotes the number of buildings that can see the sun.

inputFormat

The first line of input contains an integer T which denotes the number of test cases. Each test case consists of two lines:

  1. The first line contains a single integer n representing the number of buildings.
  2. The second line contains n space-separated integers \(h_1, h_2, \dots, h_n\) indicating the heights of the buildings.

Note: The input is provided via standard input (stdin).

outputFormat

For each test case, output a single integer representing the number of buildings that can see the sun. Each result should be printed on its own line on standard output (stdout).

## sample
2
5
3 1 4 5 2
4
6 5 7 4
3

2

</p>