#C13571. Longest Increasing Contiguous Subsequence
Longest Increasing Contiguous Subsequence
Longest Increasing Contiguous Subsequence
Given an array of integers, your task is to find the longest contiguous subsequence that is strictly increasing. In other words, you need to identify the longest segment of the array where each element is greater than its previous element. If there are multiple subsequences with the same maximum length, return the one that appears first.
For example, if the input array is [1, 3, 2, 3, 4, 8, 1, 2, 3, 2, 1]
, then the longest increasing contiguous subsequence is [2, 3, 4, 8]
.
Note: All formulas, if any, are represented in \( \LaTeX \) format.
inputFormat
The input is provided via standard input. The first line contains an integer ( n ), the number of elements in the array. The second line contains ( n ) space-separated integers representing the array.
outputFormat
Output the longest increasing contiguous subsequence as a sequence of integers separated by a single space. If the array is empty, output nothing.## sample
0