luogu#P7865. 「EVOI-RD1」无人机航拍

「EVOI-RD1」无人机航拍

Background

City T is holding an event and needs aerial overview photos. A drone fleet was invited to do the filming. 一E孤行 is the captain of the team, and he arranges the drones’ positions based on the size of the square.

Problem Description

There is a square, which can be seen as an n×mn \times m rectangle. 一E孤行 has a total of ss drones. The shooting area of each drone can also be seen as a rectangle, and the shooting area of the whole drone fleet is the union of all drones’ shooting areas.

一E孤行 is responsible for arranging the drones’ positions, and the overall person in charge, WuuTue, will check her his plan. WuuTue’s checking method is to list LL important regions, and each important region is also a rectangle. How good 一E孤行’s plan is depends on how many important regions are completely inside the drone fleet’s shooting area.

Therefore, for each important region, 一E孤行 wants to know whether it is completely inside the drone fleet’s shooting area.

Input Format

The first line contains two integers nn and mm separated by spaces, describing the size of the square.

The second line contains one integer ss, the total number of drones in the fleet.

Lines 33 to s+2s+2 each contain four integers a1,b1,a2,b2a_1,b_1,a_2,b_2 separated by spaces, describing the shooting area of one drone. Here a1,b1a_1,b_1 are the coordinates of the lower-left corner of the rectangle, and a2,b2a_2,b_2 are the coordinates of the upper-right corner.

Line s+3s+3 contains one integer LL, the number of important regions listed by the overall person in charge.

The last LL lines each contain four integers r1,c1,r2,c2r_1,c_1,r_2,c_2 separated by spaces, describing one important region. Here r1,c1r_1,c_1 are the coordinates of the lower-left corner of the rectangle, and r2,c2r_2,c_2 are the coordinates of the upper-right corner.

Output Format

Output LL lines. For each important region, output Yes if it is completely within the fleet’s shooting area; otherwise output No. Each answer should be on its own line.

9 9 
3 
2 1 4 4 
2 5 4 9 
5 2 7 6 
2 
3 3 6 6 
5 6 8 8
Yes 
No

Hint

Sample Explanation

As shown in the figure below, regions A,B,CA,B,C are the areas covered by the drones arranged by someone, and regions D,ED,E are the key regions listed by WuuTue during checking. Region DD can be fully covered, while region EE cannot be fully covered.

Constraints and Notes

This problem uses bundled tests.

For 40%40\% of the testdata: 1n10001 \le n \le 1000, 1s1001 \le s \le 100
For 100%100\% of the testdata:

  • 1n,m3×1031 \le n, m \le 3 \times 10^{3}
  • 1s,L1061 \le s,L \le 10^6
  • 1x1<x2n1 \le x_1 < x_2 \le n
  • 1r1<r2n1 \le r_1 < r_2 \le n
  • 1y1<y2m1 \le y_1 < y_2 \le m
  • 1c1<c2m1 \le c_1 < c_2 \le m

Translated by ChatGPT 5