#K76197. Longest Increasing Temperature Period

    ID: 34589 Type: Default 1000ms 256MiB

Longest Increasing Temperature Period

Longest Increasing Temperature Period

You are given the number of days d and a list of recorded temperatures. Your task is to determine the length of the longest period of consecutive days during which the temperature strictly increases every day.

Formally, for a sequence of temperatures \(T_1, T_2, \dots, T_d\), find the maximum integer \(L\) (where \(L > 1\)) such that there exists an index \(i\) with \(1 \le i \le d - L + 1\) and \(T_i < T_{i+1} < \cdots < T_{i+L-1}\). If no such period exists, output 0.

For example, if d = 7 and the temperatures are [30, 31, 32, 33, 29, 30, 31], then the longest strictly increasing period is 4 days from day 1 to day 4.

inputFormat

The first line of input contains an integer d representing the number of days.

The second line contains d space-separated integers representing the temperatures for each day.

outputFormat

Output a single integer representing the length of the longest period of consecutive days with strictly increasing temperatures. If no such period exists, output 0.

## sample
7
30 31 32 33 29 30 31
4