显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAXN 1000010
inline ll read(){
ll x=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){
if(c=='-')f=-1;
c=getchar();
}
while(c>='0'&&c<='9'){
x=x*10+c-'0';
c=getchar();
}
return x*f;
}
ll c[MAXN],t[MAXN],sum[MAXN];
ll n,q;
int main(){
freopen("Max.in","r",stdin);
freopen("Max.out","w",stdout);
n=read(),q=read();
for(int i=1;i<=n;i++)c[i]=read();
for(int i=1;i<=n;i++){
t[i]=read();
if(c[i]>t[i])sum[c[i]-t[i]-1]++;
}
for(int i=1000000;i;i--)sum[i]+=sum[i+1];
for(int i=1;i<=q;i++){
ll v=read(),s=read();
if(sum[s]>=v)cout<<"YES\n";
else cout<<"NO\n";
}
return 0;
}