You must be very familiar with the classic maximum subsequence problem:
Given an integer sequence A1, A2, ..., An, Find a continuous subsequence A[i..j] with maximum sum: Ai + Ai+1 + ... + Aj. (1 <= i <= j <= n)
As a talented ACMer, you can solve this problem in seconds. So here comes a harder version:
Given an integer sequence A1, A2, ..., An, Find a continuous subsequence A[i..j] with maximum average value: (Ai + Ai+1 + ... + Aj) / (j - i + 1). (1 <= i <= j <= n)
As a talented ACMer, you can solve this problem in minutes. So here comes a more harder version:
Given an integer sequence A1, A2, ..., An, Find a continuous subsequence A[i..j] with maximum squared average value: (Ai + Ai+1 + ... + Aj)^2 / (j - i + 1). (1 <= i <= j <= n)
As a talented ACMer, can you solve this problem?