#C6045. Buildings With Sunlight
Buildings With Sunlight
Buildings With Sunlight
In this problem, you are given a list of building heights arranged in a row. A building can see the sunlight if it is strictly taller than all the buildings to its left. The buildings are numbered starting from 1. Your task is to determine and print the indices of the buildings that can see the sunlight.
More formally, given an array (a_1, a_2, \dots, a_n) where (a_i) represents the height of the (i^{th}) building, a building at position (i) can see the sunlight if and only if (a_i > \max{a_1, a_2, \dots, a_{i-1}}).
inputFormat
The first line contains an integer (n) ( (1 \le n \le 10^5)) representing the number of buildings. The second line contains (n) space-separated integers representing the heights of the buildings.
outputFormat
Output the indices of the buildings that can see the sunlight, separated by a single space.## sample
5
3 1 4 2 5
1 3 5