report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Maximum mean - MarisaOJ: Marisa Online Judge

Maximum mean

Time limit: 1000 ms
Memory limit: 256 MB
You are given an array $A$ of $n$ integers. Find a subarray of length at least $k$ with the maximum mean. ### Input - The first line contains 2 integers $n, k$. - The second line contains $n$ integers $A_i$. ### Output - Print the largest mean of all subarrays of length at least $k$. Your answer will be considered correct if its absolute or relative error does not exceed $10^{-3}$. In other words, your answer, $x$, will be compared to the correct answer, $y$. If $|x-y| < 10^{-3}$, then your answer will be considered correct. ### Constraints - $1 \le k \le n \le 10^5$. - $1 \le A_i \le 10^9$ ### Example Input: ``` 5 3 1 2 3 4 5 ``` Output: ``` 4.000 ```
Binary search on answer
Reading
Minimum maximum
Beautiful number
Multiplication table
k-th digit
Maximum mean
Birthday
Sorting the differences
Collecting
Topic
Binary search
Rating 1200
Solution (1) Solution