#C1180. Forest Drone Coverage
Forest Drone Coverage
Forest Drone Coverage
In this problem, you are given a forest represented as a grid with R rows and C columns. A number of drones fly over the forest, each covering a rectangular area. The rectangular area for a drone is given by its top-left and bottom-right coordinates: \( (r_1, c_1) \) and \( (r_2, c_2) \) respectively. Your task is to determine whether the entire forest grid is covered by at least one drone. In other words, every cell in the grid must lie in at least one of the given rectangular areas.
Note: The coordinates are zero-indexed (i.e. rows and columns start from 0).
inputFormat
The input is given via standard input (stdin) and has the following format:
- The first line contains two space-separated integers \( R \) and \( C \), representing the number of rows and columns of the forest grid respectively.
- The second line contains an integer \( N \) denoting the number of drones.
- Each of the next \( N \) lines contains four space-separated integers: \( r_1 \), \( c_1 \), \( r_2 \), \( c_2 \). These represent the top-left and bottom-right coordinates of the rectangular area covered by a drone.
outputFormat
Output a single line to standard output (stdout). Print YES
if every cell of the forest grid is covered by at least one drone; otherwise, print NO
.
5 5
2
0 0 2 2
2 2 4 4
NO