#P10450. [USACO03MAR] Best Cow Fences G

[USACO03MAR] Best Cow Fences G

Problem Description

Original problem from: USACO 2003 Mar. Green.

Given a non-negative integer sequence AA of length nn, find a subarray with the maximum average value, with length at least LL.

Input Format

The first line contains two integers nn and LL, separated by spaces.

The second line contains nn non-negative integers separated by spaces, representing AiA_i.

Output Format

Output one integer, which is 10001000 times this maximum average. Do not round; output it directly.

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

Hint

Constraints: 1n105,0Ai20001 \leq n \leq 10^5,0 \leq A_i \leq 2000

Translated by ChatGPT 5