Later, visitors will scan a QR code at various spots on the blueprint, and Priya's system must instantly tell whether each scanned point falls inside a given rectangular "garden zone" — for many scans at once. Given an axis-aligned rectangle by two OPPOSITE corners (which may be given in any order, not guaranteed bottom-left/top-right), answer Q queries: for each point, print "YES" if it lies inside or on the rectangle boundary, else "NO".
Input
Line1: x1 y1 x2 y2 (opposite corners). Line2: Q. Then Q lines of px py.
Output
Q lines, each "YES" or "NO".
Constraints
1 ≤ Q ≤ 10^5, -10^9 ≤ coords ≤ 10^9
Sample Input
5 5 1 1 2 3 3 10 10
Sample Output
YES NO
main.c
Loading editor…
Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.