#P1404. 平均数

平均数

Description

Given a sequence of length nn, find a contiguous subarray whose average is maximized, with the subarray length m\ge m.

Input Format

The first line contains two integers nn and mm.
The next nn lines each contain an integer aia_i, representing the ii-th number of the sequence.

Output Format

Output a single integer: 10001000 times the maximum average. If there is a fractional part, truncate it directly; do not round.

10 6
6
4
2
10
3
8
5
9
4
1

6500

Hint

Constraints

  • For 60%60\% of the testdata, it is guaranteed that mn104m\le n\le 10^4
  • For 100%100\% of the testdata, it is guaranteed that 1mn1051 \leq m\le n\le 10^5, 0ai20000\le a_i\le2000

Translated by ChatGPT 5