아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Weather Trends

시간 제한20초메모리 제한1024 MB

요약
n일간의 기온과 구간 길이 m이 주어질 때 m일 이내에서 앞선 날 대비 최대 기온 상승 폭을 구한다.
난이도

보통10점 중 5점

유형
슬라이딩 윈도우, 누적 합
정답자
아직 제출이 없습니다

문제

George is an aspiring meteorologist who is passionate about analyzing temperature data. He is tasked with finding the largest temperature increase that occurs within specific time frames. Your task is to help George develop an efficient algorithm to calculate such temperature increases for any time interval.

Given a sequence of daily temperature measurements over a period of n days, George is interested in finding the greatest temperature increase that occurs within a window of m days. In other words, he wants to identify the maximum temperature difference between two days, where the second day occurs no more than m days after the first one.

입력

The first line of input contains a single integer n, representing the number of available temperature measurements. The second line contains a single integer m, indicating the maximum time interval in days. The third line contains n temperature values, separated by spaces.

출력

Output a single real number, representing the maximum temperature increase that occurs within the specified m-day interval.

Your task is to implement an efficient algorithm that can solve this problem for George. Additionally, ensure that your output has an absolute or relative error of at most 10-6.

예제2

  1. 예제 1

    입력
    10
    6
    30 28 30 29 32 26 27 30 28 33
    
    예상 출력
    7.000000
    
  2. 예제 2

    입력
    7
    3
    31 32 33 25.91 31 30 35
    
    예상 출력
    5.090000