#P1589. 泥泞路

泥泞路

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 LL, 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 nn and LL, representing the number of muddy segments and the length of a plank.

The next nn lines each contain two integers ss and ee, representing the start and end of a muddy segment.

Output Format

A single positive integer, the number of planks.

3 3
1 6
13 17
8 12
5

Hint

For 100%100\% of the testdata, n,L10000n,L \leq 10000, se109s \leq e \leq 10^9.

Translated by ChatGPT 5