#P1019. Problem 3. Maximizing Productivity
Problem 3. Maximizing Productivity
当前没有测试数据。
一、Problem Name
Maximizing Productivity
二、Problem Description
Farmer John has () farms, numbered from to . It is known that FJ closes farm at time . Bessie wakes up at time , and wants to maximize the productivity of her day by visiting as many farms as possible before they close. She plans to visit farm on time . Bessie must arrive at a farm strictly before Farmer John closes it to actually visit it.
Bessie has () queries. For each query, she gives you two integers and . For each query, output whether Bessie can visit at least farms if she wakes up at time .
三、Input Format (input arrives from the terminal / stdin)
- The first line consists of and .
- The second line consists of ().
- The third line consists of ().
- The next lines each consist of two integers () and ().
四、Output Format (print output to the终端 / stdout)
For each of the queries, output YES or NO on a new line.
五、Sample Input and Output
Sample Input
5 5
3 5 7 9 12
4 2 3 3 8
1 5
1 6
3 3
4 2
5 1
Sample Output
YES
NO
YES
YES
NO
Explanation: For the first query, Bessie will visit the farms at time , so she will only get to visit farm on time before FJ closes the farm. For the second query, Bessie will not be able to visit any of the farms on time. For the third query, Bessie will visit farms on time. For the fourth and fifth queries, Bessie will be able to visit all but the first farm on time.
六、Scoring Rules
- Inputs 2 - 4: .
- Inputs 5 - 9: .
- Inputs 10 - 17: No additional constraints.
Problem credits: Chongtian Ma.