Maximizing Productivity
시간 제한: 2000ms메모리 제한: 1024MB출처: USACO 2024 February BronzeBOJ 31650
문제
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 .
입력
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 ().
출력
For each of the queries, output YES or NO on a new line.
예제
예제 1
입력
5 5 3 5 7 9 12 4 2 3 3 8 1 5 1 6 3 3 4 2 5 1
출력
YES NO YES YES NO
코드를 제출하려면 로그인하세요.