#C11515. Longest Increasing Group

    ID: 40840 Type: Default 1000ms 256MiB

Longest Increasing Group

Longest Increasing Group

Given a sequence of integers representing heights, your task is to determine the length of the longest strictly increasing group in the sequence. In other words, find the length of the longest subsequence such that each element is greater than the previous one.

The problem can be solved with an efficient algorithm based on binary search, similar to the Longest Increasing Subsequence (LIS) algorithm. The answer should be computed in \(O(n \log n)\) time.

Input: The first line contains an integer \(n\) denoting the number of elements. The second line contains \(n\) integers separated by spaces.

Output: Output a single integer representing the length of the longest increasing group.

inputFormat

The input consists of two lines:

  • The first line contains a single integer \(n\), the number of elements in the sequence.
  • The second line contains \(n\) space-separated integers.

outputFormat

Output a single integer: the length of the longest strictly increasing group in the sequence.

## sample
6
5 3 4 8 6 7
4

</p>