#C5723. Longest Contiguous Increasing Subsequence
Longest Contiguous Increasing Subsequence
Longest Contiguous Increasing Subsequence
You are given a sequence of n scores. Your task is to find the longest contiguous subsequence where each score is strictly greater than the previous one. In other words, if the subsequence consists of scores \(a[i], a[i+1], \dots, a[j]\), then it must hold that \(a[k] < a[k+1]\) for all \(i \le k < j\). If there are multiple answers, output the one that appears first. The subsequence should be reported by its length and by the list of the corresponding indices (1-indexed).
Note: A contiguous subsequence means that the selected elements must occur consecutively in the original sequence.
inputFormat
The input is read from standard input (stdin) and consists of two lines:
- The first line contains an integer \(n\) (\(1 \leq n \leq 10^5\)), which denotes the number of scores.
- The second line contains \(n\) space-separated integers representing the scores.
outputFormat
The output should be written to standard output (stdout) as two lines:
- The first line contains a single integer, the length of the longest contiguous increasing subsequence.
- The second line contains the 1-indexed positions of the subsequence's elements, separated by spaces.
If the sequence consists of only one element, output the length \(1\) and the index \(1\).
## sample6
10 20 10 30 40 50
4
3 4 5 6
</p>