#P1567. Longest Increasing Temperature Sequence
Longest Increasing Temperature Sequence
Longest Increasing Temperature Sequence
KC is tired of the sweltering summer heat. He would rather endure the cold of the Arctic than the scorching summers of Xiamen. Recently, he started studying weather patterns and collected the highest temperature data over N consecutive days. Using these data, he wants to predict the future weather by finding the longest consecutive period during which the maximum temperature was strictly increasing.
Mathematically, given a sequence of temperatures \(a_1, a_2, \dots, a_N\), determine the maximum length of a subarray \(a_l, a_{l+1}, \dots, a_r\) such that for every \(i\) with \(l \leq i < r\), the condition \(a_i < a_{i+1}\) holds.
inputFormat
The first line contains an integer \(N\) (\(1 \leq N \leq 10^6\)), representing the number of days. The second line contains \(N\) space-separated integers, where each integer denotes the highest temperature on that day.
outputFormat
Output a single integer representing the length of the longest consecutive period during which the temperature was strictly increasing.
sample
6
30 31 32 28 29 30
3