Three Slices
시간 제한1초메모리 제한1024 MB
양의 정수 배열과 한도 K가 주어질 때, 어떤 위치에서 시작하는 길이 M인 연속한 세 구간의 합이 각각 K 이하가 되는 가장 큰 M을 구한다.
문제
You are given an array , , , , of positive integers. Also, you are given an positive integer . Your task is to find the largest positive integer such that the following condition is satisfied:
-
There exists an integer such that
입력
The first line contains two integers, and . The second line contains integers, the array given in order.
출력
Output a single positive integer denoting the largest possible . If there is no such , output .