CF1041D Glider

题目描述

``` 你在玩一个吃鸡游戏,你现在要跳伞。你的飞机现在在高度为$h$的空中飞行,你每飞一个单位长度的距离,你就会下落一个单位长度的高度,当然,有些地方是上升气流,你不会下落,你会往前直飞,由于你想在空中就被人打死,求你最远的飞行距离

输入格式

第一行两个正整数$n$,$h$,代表有$n$段上升气流,飞机的高度为$h$。 接下来$n$行,每行两个数$x_{i1}$,$x_{i2}$。代表$x_{i1}$至$x_{i2}$这段区间为上升气流。

输出格式

一个整数,代表你最远的飞行距离 ```

说明/提示

In the first example if the glider can jump out at $ (2, 4) $ , then the landing point is $ (12, 0) $ , so the distance is $ 12-2 = 10 $ . In the second example the glider can fly from $ (16,10) $ to $ (34,0) $ , and the distance is $ 34-16=18 $ . In the third example the glider can fly from $ (-100,1000000000) $ to $ (1999999899,0) $ , so the distance is $ 1999999899-(-100)=1999999999 $ .