题目描述
Problem Description
You plan to spend a day taking photographs of the South Dakota Badlands, known for their spectacular and unusual land formations. As an amateur photographer with particular lighting preferences, you have identified various features to photograph from a specific location. For each feature, you have determined the earliest and latest time of day when the sun's position is ideal. However, each photograph requires time to set up the tripod and camera, and you are meticulous about your work. You wonder if it is possible to take all these photographs in one day.
Input Format
The first line of the input contains two integers \( n \) (\( 1 \le n \le 10^4 \)) and \( t \) (\( 1 \le t \le 10^5 \)), where \( n \) is the number of photographs you want to take and \( t \) is the time required to take each photograph. Following this are \( n \) additional lines, each describing the available time period for one of the photographs. Each line contains two nonnegative integers \( a \) and \( b \), where \( a \) is the earliest time you may begin working on that photograph, and \( b \) is the time by which the photograph must be completed, with \( a + t \le b \le 10^9 \).
Output Format
Display "yes" if it is possible to take all \( n \) photographs, and "no" otherwise.
Sample Input and Output
Input Sample #1
2 10
0 15
5 20
Output Sample #1
yes
Input Sample #2
2 10
1 15
0 20
Output Sample #2
no
Input Sample #3
2 10
5 30
10 20
Output Sample #3
yes
Notes
Time limit: 6 seconds, Memory limit: 512 MB.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分