시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB129675852.252%

문제

The idea behind your latest business adventure, BarGain Overview (BGO), is to collect the history of prices for a certain item that is available for sale on the web. The BarGain score of a particular day is defined as the number of days since the price was lower or equal to today's price. The worst BarGain score is thus $1$, and if the price is strictly better than all previous prices ever recorded, then it is infinity. You want to report the BarGain score to your customers to help them identify a good buy.

입력

The first line of input contains a single integer $2 \leq n \leq 400\,000$, the number of days for which you have collected price data for the item. On the second line of input follows $n$ space-separated integers $p_1, p_2, \ldots, p_{n}$, where $0 \leq p_i \leq 2 \cdot 10^6$ is the price of the item $i-1$ days ago. Today's price is $p_1$.

출력

A line containing today's BarGain score.

예제 입력 1

6
9 10 11 9 12 11

예제 출력 1

3

예제 입력 2

3
1 2 3

예제 출력 2

infinity

출처

Contest > Bergen Open > Bergen Open 2021 J번

  • 문제를 만든 사람: Torstein Strømme