#abc353a. A - Buildings

A - Buildings

Score: 100100 points

问题陈述

NN 座建筑物排成一行。从左边数第 ii 座建筑物的高度为 HiH_i

确定是否存在比最左边的第一座建筑物更高的建筑物。如果存在这样的建筑物,请找出从左边数这样的建筑物中最左边的位置。

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

There are NN buildings aligned in a row. The ii-th building from the left has a height of HiH_i.

Determine if there is a building taller than the first one from the left. If such a building exists, find the position of the leftmost such building from the left.

Constraints

  • 1N1001 \leq N \leq 100
  • 1Hi1001 \leq H_i \leq 100
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN

H1H_1 H2H_2 \ldots HNH_N

Output

If no building is taller than the first one from the left, print -1.

If such a building exists, print the position (index) of the leftmost such building from the left.

Sample Input 1

4
3 2 5 2

Sample Output 1

3

The building taller than the first one from the left is the third one from the left.

Sample Input 2

3
4 3 2

Sample Output 2

-1

No building is taller than the first one from the left.

Sample Input 3

7
10 5 10 2 10 13 15

Sample Output 3

6

The buildings taller than the first one from the left are the sixth and seventh ones. Among them, the leftmost is the sixth one.

update @ 2024/9/11 17:14:02