103530: [Atcoder]ABC353 A - Buildings

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:9 Solved:0

Description

Score: $100$ points

Problem Statement

There are $N$ buildings aligned in a row. The $i$-th building from the left has a height of $H_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

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

Input

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

$N$
$H_1$ $H_2$ $\ldots$ $H_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.

Output

分数:100分

问题描述

有一排共有N座建筑。从左边数第i座建筑的高度为H_i。

判断是否存在一座建筑比最左边的那座还要高。如果存在,找出从左边数起最左边的这样一座建筑的位置。

限制条件

  • 1 ≤ N ≤ 100
  • 1 ≤ H_i ≤ 100
  • 所有输入值都是整数。

输入

输入通过标准输入给出以下格式:

$N$
$H_1$ $H_2$ $\ldots$ $H_N$

输出

如果不存在比最左边建筑高的建筑,打印-1

如果存在这样的建筑,打印其从左边数起的位置(索引)。


样例输入1

4
3 2 5 2

样例输出1

3

比最左边建筑高的建筑是左边数起的第三座。


样例输入2

3
4 3 2

样例输出2

-1

没有建筑比最左边的那座高。


样例输入3

7
10 5 10 2 10 13 15

样例输出3

6

比最左边建筑高的建筑是第六座和第七座。其中,最左边的是第六座。

Sample Input Copy


Sample Output Copy


加入题单

算法标签: