#674
Silver II
Maximizing Productivity
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Farmer John has NN (1N21051 \leq N \leq 2 \cdot 10^5) farms, numbered from 11 to NN. It is known that FJ closes farm ii at time cic_i. Bessie wakes up at time SS, and wants to maximize the productivity of her day by visiting as many farms as possible before they close. She plans to visit farm ii on time ti+St_i + S. Bessie must arrive at a farm strictly before Farmer John closes it to actually visit it.

Bessie has QQ (1Q2105)(1 \leq Q \leq 2 \cdot 10^5) queries. For each query, she gives you two integers SS and VV. For each query, output whether Bessie can visit at least VV farms if she wakes up at time SS.

입력

The first line consists of NN and QQ.

The second line consists of c1,c2,c3cNc_1, c_2, c_3 \dots c_N (1ci1061 \leq c_i \leq 10^6).

The third line consists of t1,t2,t3tNt_1, t_2, t_3 \dots t_N (1ti1061 \leq t_i \leq 10^6).

The next QQ lines each consist of two integers VV (1VN1 \leq V \leq N) and SS (1S1061 \leq S \leq 10^6).

출력

For each of the QQ 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

예제 출력 1

YES
NO
YES
YES
NO

점수

Inputs 2-4: N,Q103N,Q\le 10^3Inputs 5-9: ci,ti20c_i, t_i \le 20Inputs 10-17: No additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Silver II1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.