import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
int n = sc.nextInt();
int s = sc.nextInt();
int[][] city= new int[x+1][y+1];
int[][] xxx= new int[x+1][y+1];
for(int i=1;i<=n;i++){
int x1 = sc.nextInt();
int y1 = sc.nextInt();
int x2 = sc.nextInt();
int y2 = sc.nextInt();
for (int m =y1;m <= y2;m++) {
for (int f = x1;f <= x2;f++) {
city[f][m]++;
xxx[f][m]=i;
}
}
}
int[] x1 = new int[s];
int[] y1 = new int[s];
for (int i = 0; i < s; i++) {
x1[i] = sc.nextInt();
y1[i] = sc.nextInt();
}
for (int i = 0; i < s; i++) {
if(city[x1[i]][y1[i]]==0){
System.out.println("N");
}else {
System.out.println("Y "+city[x1[i]][y1[i]]+" "+xxx[x1[i]][y1[i]]);
}
}
}
}
洛谷P1830轰炸Ⅲ java解法
最新推荐文章于 2024-09-24 09:19:59 发布