Problem list
Log in
#coci00351 · COCI 2014/2015 Contest 7

Prosjek

Platinum IV 1.0 s 64 MB

You are given an array of $N$ integers. Find a consecutive subsequence of numbers of the length at least $K$ that has the maximal possible average. Please note: the average of a subsequence is the sum of all the numbers in the subsequence divided by its length.

Input

The first line of input contains two integers $N$ (1 ⩽$N$ ⩽$3 \cdot 10^{5}$) and $K$ (1 ⩽$K$ ⩽$N$). The second line of input contains $N$ integers $a_{i}$ (1 ⩽$a_{i}$ ⩽$10^{6}$).

Output

The first and only line of output must contain the maximal possible average. An absolute deviation of ±0.001 from the official solution is permitted.

Constraints

In test cases worth 30% of total points, it will hold that $N$ is not larger than 5 000.

Example 1

Input
4 1
1 2 3 4
4 2
2 4 3 4
6 3
7 1 2 1 3 6
Output
output
output
4.000000
3.666666
3.333333
Source
COCI 2014/2015 Contest 7
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code