#K42442. Longest Improvement Streak

    ID: 27088 Type: Default 1000ms 256MiB

Longest Improvement Streak

Longest Improvement Streak

You are given the number of days n and a sequence of n integers representing the number of tasks completed by an employee on each day. Your task is to determine the length of the longest streak of consecutive days during which the performance strictly improves, i.e., each day the employee completes more tasks than the previous day.

The streak resets to 1 whenever a day does not show an improvement compared to the previous day. Note that even if there is no improvement at all, the maximum streak is 1 since each individual day counts as a streak of length 1.

Example: For the sequence: [1, 2, 2, 3, 4, 1, 2, 3, 4, 5], the longest improvement streak is 5.

The formula for a streak can be explained as follows: If we denote the daily tasks by \( a_1, a_2, \dots, a_n \), then the streak is defined as the maximal integer \( k \) such that \( a_{i} < a_{i+1} < \dots \lt; a_{i+k-1} \) for some \( i \). The answer is the maximum \( k \) obtained over all possible starting points \( i \).

inputFormat

The input is given in two lines:

  • The first line contains a single integer \( n \) representing the number of days.
  • The second line contains \( n \) space-separated integers, where the \( i^{th} \) integer represents the number of tasks completed on the \( i^{th} \) day.

outputFormat

Output a single integer which is the length of the longest streak of improved performance.

## sample
10
1 2 2 3 4 1 2 3 4 5
5