#C8971. Sunlit Skyscrapers
Sunlit Skyscrapers
Sunlit Skyscrapers
In a modern city, the sunlight only reaches the skyscrapers that are taller than all the buildings to their left. That is, the first skyscraper always receives sunlight, and any subsequent skyscraper receives sunlight if its height is strictly greater than the maximum height of all skyscrapers before it.
Formally, given a list of skyscraper heights (h_1, h_2, \ldots, h_n), a skyscraper (h_i) (for (i \ge 1)) receives sunlight if (h_i > \max{h_1, h_2, \ldots, h_{i-1}}) (with the convention that (h_1) always receives sunlight). Your task is to determine the number of skyscrapers receiving sunlight for each test case.
inputFormat
The input is read from standard input (stdin). The first line contains an integer (T), representing the number of test cases. For each test case, the first line contains an integer (N), the number of skyscrapers. The following line contains (N) space-separated integers representing the heights of the skyscrapers.
outputFormat
For each test case, output a single integer on a new line — the number of skyscrapers that receive sunlight.## sample
3
6
4 2 3 7 4 8
4
1 1 1 1
5
5 3 9 2 1
3
1
2
</p>