Minimum Days to Make M Bouquets
Given a bloom day array, find the minimum number of days to be able to make M bouquets each using K adjacent flowers.
Input format
The first line contains N, M (bouquets needed), and K (adjacent flowers per bouquet). The second line contains N bloom days.
Output format
Print the minimum day on which M bouquets can be made, or -1 if it is impossible.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
5 1 1
1 10 3 10 2Expected output
1Example 2
Input
5 3 1
1 10 3 10 2Expected output
3