#C9099. Marathon Hydration Coverage

    ID: 53154 Type: Default 1000ms 256MiB

Marathon Hydration Coverage

Marathon Hydration Coverage

You are given a marathon route of length \(L\) and \(n\) hydration points. Each hydration point is located at a position \(x\) and has a range \(r\). This point can provide hydration coverage over the interval \([x-r, x+r]\). Your task is to determine the minimum number of hydration points needed to cover the entire route from \(0\) to \(L\). If it is not possible to cover the entire route, output \(-1\).

Hint: A greedy strategy can be used to always choose the hydration point that extends your coverage the farthest from the current covered position.

inputFormat

The first line contains two integers \(n\) and \(L\) where \(n\) is the number of hydration points and \(L\) is the total length of the marathon route. Each of the following \(n\) lines contains two space-separated integers \(x\) and \(r\), representing the position and the range of a hydration point respectively.

outputFormat

Output a single integer, which is the minimum number of hydration points required to cover the entire route from \(0\) to \(L\). If it is not possible to cover the entire route, output \(-1\).

## sample
5 10
1 2
2 3
5 2
7 1
9 3
3