Submit | All submissions | Best solutions | Back to list |
EISHORT - Shortest subarray |
Given an array of positive integers A where each element has value at most 106. Find the shortest subarray of A such that the sum of elements is not less than k.
Input
The first line contains the number of elements n and the integer k (0 < n ≤ 105, 0 < k ≤ 109).
The second line is the elements in array A
Output
The length of the shortest subarray
Sample
Input |
Output |
5 6 1 2 4 1 6 |
1 |
Added by: | Ha Minh Ngoc |
Date: | 2019-05-06 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: GOSU |