#C1808. Highlighted Houses

    ID: 45054 Type: Default 1000ms 256MiB

Highlighted Houses

Highlighted Houses

Given n houses arranged in a row and an array of n integers representing the number of lights on each house, determine which houses are highlighted. A house is considered highlighted if it has strictly more lights than its immediate neighbors.

For a house at index \(i\) (0-indexed):

  • If \(i = 0\) and \(n > 1\), it is highlighted if \(\text{lights}[0] > \text{lights}[1]\).
  • If \(i = n-1\) and \(n > 1\), it is highlighted if \(\text{lights}[n-1] > \text{lights}[n-2]\).
  • If \(0 < i \text{lights}[i-1]\) and \(\text{lights}[i] > \text{lights}[i+1]\).

When \(n = 1\), there are no neighbors, so no house is highlighted.

You are required to output the indices (0-indexed) of all highlighted houses in increasing order. If no house qualifies, output an empty line.

inputFormat

The input is read from standard input (stdin) and includes:

  1. An integer \(n\) representing the number of houses.
  2. A line of \(n\) space-separated integers representing the number of lights on each house.

outputFormat

Output the indices (0-indexed) of the highlighted houses in a single line separated by a space. If no house qualifies, output an empty line.

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

</p>