import java.io.*;
public class Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException {
String[] str;
str = br.readLine().split(" ");
int n,m,x,y,i,j,k,q,w,e,r;
n = Integer.parseInt(str[0]);
m = Integer.parseInt(str[1]);
x = Integer.parseInt(str[2]);
y = Integer.parseInt(str[3]);
int[][] city = new int[n+1][m+1];
int[][] round = new int[n+1][m+1];
for(i = 1 ; i <= x ; i++){
str = br.readLine().split(" ");
q = Integer.parseInt(str[0]);
w = Integer.parseInt(str[1]);
e = Integer.parseInt(str[2]);
r = Integer.parseInt(str[3]);
for(j = q ; j <= e ; j++){
for(k = w ; k <= r ; k++){
city[j][k]++;
round[j][k] = i;
}
}
}
for(i = 0 ; i < y ; i++){
str = br.readLine().split(" ");
n = Integer.parseInt(str[0]);
m = Integer.parseInt(str[1]);
if(city[n][m] != 0){
out.write("Y " + city[n][m] + " " + round[n][m] + "\n");
}
else{
out.write("N\n");
}
}
out.flush();
out.close();
br.close();
}
}
洛谷 P1830 轰炸III Java
最新推荐文章于 2024-05-31 10:46:10 发布