1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 #include<algorithm> 5 using namespace std; 6 int x[100005],y[100005]; 7 int n,m,k,q; 8 int main() 9 { 10 int t; 11 scanf("%d",&t); 12 while(t--) 13 { 14 scanf("%d%d%d%d",&n,&m,&k,&q); 15 memset(x,0,sizeof(x)); 16 memset(y,0,sizeof(y)); 17 for(int i=0; i<k; i++) 18 { 19 int x0,y0; 20 scanf("%d%d",&x0,&y0); 21 x[x0]=1; 22 y[y0]=1; 23 } 24 for(int i=1; i<=n; i++) 25 x[i]+=x[i-1]; 26 for(int i=1; i<=m; i++) 27 y[i]+=y[i-1]; 28 while(q--) 29 { 30 int x1,y1,x2,y2; 31 scanf("%d%d%d%d",&x1,&y1,&x2,&y2); 32 if(x[x2]-x[x1-1]==x2-x1+1||y[y2]-y[y1-1]==y2-y1+1) 33 printf("Yes\n"); 34 else 35 printf("No\n"); 36 } 37 } 38 return 0; 39 }
时间: 2024-10-29 19:08:19