Problem B
Watering Grass
What is the minimum number of sprinklers to turn on in order to water the entire strip of grass?
![\includegraphics[width=0.75\textwidth ]{grass}](/problems/grass/file/statement/en/img-0001.jpg)
Input
Input consists of at most
The picture above illustrates the first case from the sample input.
Output
For each test case output the minimum number of sprinklers
needed to water the entire strip of grass. If it is impossible
to water the entire strip output
Sample Input 1 | Sample Output 1 |
---|---|
8 20 2 5 3 4 1 1 2 7 2 10 2 13 3 16 2 19 4 3 10 1 3 5 9 3 6 1 3 10 1 5 3 1 1 9 1 |
6 2 -1 |