P1589 Muddy Road
Description
After a heavy rain, there are some muddy segments on the road from FJ's farm to the town. He has several planks, each of length $L$, that can be laid over these muddy segments. Find the minimum number of planks required to cover all the muddy segments.
Input Format
The first line contains positive integers $n$ and $L$, representing the number of muddy segments and the length of a plank.
The next $n$ lines each contain two integers $s$ and $e$, representing the start and end of a muddy segment.
Output Format
A single positive integer, the number of planks.
Explanation/Hint
For $100\%$ of the testdata, $n,L \leq 10000$, $s \leq e \leq 10^9$.
Translated by ChatGPT 5