luogu#P10450. [USACO03MAR] Best Cow Fences G

    ID: 10249 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 4 上传者: 标签>动态规划 DP2003二分USACO前缀和

[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: 1≤n≤105,0≤Ai≤20001 \leq n \leq 10^5,0 \leq A_i \leq 2000。

Translated by ChatGPT 5