#K646. Counting Improving Periods
Counting Improving Periods
Counting Improving Periods
Given a sequence of daily performance scores as integers, an improving period is defined as a contiguous subarray where every subsequent score is strictly greater than its previous score.
Your task is to compute the total number of such improving periods. In mathematical terms, a subarray \(S = [s_1, s_2, \ldots, s_L]\) is considered improving if and only if \(s_1 < s_2 < \cdots < s_L\) for \(L \ge 2\). Note that single elements are not counted as an improving period.
inputFormat
The input is provided via standard input (stdin) in the following format:
- The first line contains a single integer \(n\) (\(1 \le n \le 10^5\)), representing the number of days.
- The second line contains \(n\) space-separated integers, where each integer denotes the performance score for that day.
outputFormat
Output a single integer to standard output (stdout) which is the total number of consecutive improving periods in the given sequence.
## sample8
3 4 5 2 1 3 4 5
9