{"problem":{"name":"C. Intense Heat","description":{"content":"The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But an","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":4000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF1003C"},"statements":[{"statement_type":"Markdown","content":"The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.\n\nMathematicians of Berland State University came up with a special _heat intensity value_. This value is calculated as follows:\n\nSuppose we want to analyze the segment of $n$ consecutive days. We have measured the temperatures during these $n$ days; the temperature during $i$\\-th day equals $a_i$.\n\nWe denote the _average temperature_ of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the _average temperature_ from day $x$ to day $y$, we calculate it as $\\frac{\\sum \\limits_{i = x}^{y} a_i}{y - x + 1}$ (note that division is performed without any rounding). The _heat intensity value_ is the maximum of _average temperatures_ over all segments of not less than $k$ consecutive days. For example, if analyzing the measures $[3, 4, 1, 2]$ and $k = 3$, we are interested in segments $[3, 4, 1]$, $[4, 1, 2]$ and $[3, 4, 1, 2]$ (we want to find the maximum value of _average temperature_ over these segments).\n\nYou have been hired by Berland State University to write a program that would compute the _heat intensity value_ of a given period of days. Are you up to this task?\n\n## Input\n\nThe first line contains two integers $n$ and $k$ ($1 \\le k \\le n \\le 5000$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating _heat intensity value_, respectively.\n\nThe second line contains $n$ integers $a_1$, $a_2$, ..., $a_n$ ($1 \\le a_i \\le 5000$) — the temperature measures during given $n$ days.\n\n## Output\n\nPrint one real number — the _heat intensity value_, i. e., the maximum of _average temperatures_ over all segments of not less than $k$ consecutive days.\n\nYour answer will be considered correct if the following condition holds: $|res - res_0| &lt; 10^{-6}$, where $res$ is your answer, and $res_0$ is the answer given by the jury's solution.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"最近几天的热量非常强烈。来自贝兰各地的科学家研究温度和天气的变化，并声称今年夏天异常炎热。但任何科学主张如果涉及一些数字，听起来都会更加合理，因此他们决定计算一个能够代表温度高低的值。\n\n贝兰国立大学的数学家们提出了一种特殊的_热强度值_。该值的计算方法如下：\n\n假设我们要分析一段连续的 $n$ 天。我们在这 $n$ 天内测量了温度，第 $i$ 天的温度为 $a_i$。\n\n我们将某段连续天数的_平均温度_定义为该时间段内温度测量值的算术平均数。因此，若要分析从第 $x$ 天到第 $y$ 天的_平均温度_，我们计算为 $frac(sum limits_(i = x)^y a_i, y -x + 1)$（注意，除法不进行任何舍入）。_热强度值_是所有不少于 $k$ 天连续段的_平均温度_中的最大值。例如，若分析测量值 $[ 3, 4, 1, 2 ]$ 且 $k = 3$，我们关注的段为 $[ 3, 4, 1 ]$、$[ 4, 1, 2 ]$ 和 $[ 3, 4, 1, 2 ]$（我们希望找到这些段中_平均温度_的最大值）。\n\n你被贝兰国立大学雇佣，编写一个程序来计算给定时间段的_热强度值_。你准备好接受这个任务了吗？\n\n第一行包含两个整数 $n$ 和 $k$ ($1 lt.eq k lt.eq n lt.eq 5000$) —— 给定时间段的天数，以及计算_热强度值_时所考虑的最小连续天数。\n\n第二行包含 $n$ 个整数 $a_1$, $a_2$, ..., $a_n$ ($1 lt.eq a_i lt.eq 5000$) —— 给定 $n$ 天的温度测量值。\n\n输出一个实数 —— _热强度值_，即所有不少于 $k$ 天连续段的_平均温度_中的最大值。\n\n你的答案被认为是正确的，当且仅当满足以下条件：$| r e s -r e s_0 | < 10^(-6)$，其中 $r e s$ 是你的答案，$r e s_0$ 是评测标准答案。\n\n## Input\n\n第一行包含两个整数 $n$ 和 $k$ ($1 lt.eq k lt.eq n lt.eq 5000$) —— 给定时间段的天数，以及计算_热强度值_时所考虑的最小连续天数。第二行包含 $n$ 个整数 $a_1$, $a_2$, ..., $a_n$ ($1 lt.eq a_i lt.eq 5000$) —— 给定 $n$ 天的温度测量值。\n\n## Output\n\n输出一个实数 —— _热强度值_，即所有不少于 $k$ 天连续段的_平均温度_中的最大值。你的答案被认为是正确的，当且仅当满足以下条件：$| r e s -r e s_0 | < 10^(-6)$，其中 $r e s$ 是你的答案，$r e s_0$ 是评测标准答案。\n\n[samples]","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n, k \\in \\mathbb{Z} $ with $ 1 \\leq k \\leq n \\leq 5000 $.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of integers with $ 1 \\leq a_i \\leq 5000 $ for all $ i \\in \\{1, \\dots, n\\} $.\n\n**Constraints**  \n1. $ 1 \\leq k \\leq n \\leq 5000 $  \n2. $ a_i \\in \\mathbb{Z} $ and $ 1 \\leq a_i \\leq 5000 $ for all $ i \\in \\{1, \\dots, n\\} $\n\n**Objective**  \nCompute the maximum average temperature over all contiguous subarrays of length at least $ k $:  \n$$\n\\max_{\\substack{1 \\leq x \\leq y \\leq n \\\\ y - x + 1 \\geq k}} \\left( \\frac{1}{y - x + 1} \\sum_{i=x}^{y} a_i \\right)\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF1003C","tags":["brute force","implementation","math"],"sample_group":[["4 3\n3 4 1 2","2.666666666666667"]],"created_at":"2026-03-03 11:00:39"}}