#K69032. Longest Increasing Elevation Sequence

    ID: 32996 Type: Default 1000ms 256MiB

Longest Increasing Elevation Sequence

Longest Increasing Elevation Sequence

You are given a sequence of integer elevations. Your task is to determine the length of the longest contiguous subsequence such that each element in the subsequence is strictly greater than its immediately preceding element.

In other words, if the list of elevations is represented as \(a_1, a_2, \dots, a_n\), you are to find the maximum length \(L\) such that there exists an index \(i\) for which \(a_i < a_{i+1} < \cdots < a_{i+L-1}\). For example, given the elevations [1, 2, 2, 4, 3, 4, 5, 7], the longest strictly increasing contiguous subsequence is [3, 4, 5, 7] with a length of 4.

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  • The first line contains a single integer \(n\) — the number of elevations.
  • The second line contains \(n\) space-separated integers representing the elevations.

outputFormat

Output to standard output (stdout) a single integer that represents the length of the longest contiguous subsequence of strictly increasing elevations.

You may denote the answer mathematically as \(\text{max_length} = \max_{\text{valid segments}}(\text{length of the segment})\).

## sample
8
1 2 2 4 3 4 5 7
4

</p>