#K50057. Grid Operation Aggregation
Grid Operation Aggregation
Grid Operation Aggregation
You are given a grid with n rows and m columns, initially filled with zeros. You need to perform k operations on this grid. In each operation, you are given four integers \(x_1, y_1, x_2, y_2\) which represent the top left and bottom right coordinates of a subgrid. For every cell \((i, j)\) in this subgrid (i.e., \(x_1 \le i \le x_2\) and \(y_1 \le j \le y_2\)), increment its value by 1. The task is to output the final grid after all operations have been applied.
Note: All coordinates are 1-indexed.
inputFormat
The first line contains three integers \(n\), \(m\) and \(k\) separated by spaces, where \(n\) and \(m\) denote the dimensions of the grid, and \(k\) is the number of operations.
Each of the next \(k\) lines contains four integers \(x_1\), \(y_1\), \(x_2\), \(y_2\) separated by spaces, describing an operation to be applied to the grid.
outputFormat
Output the final grid after performing all operations. Each of the \(n\) lines should contain \(m\) integers separated by a single space representing a row of the grid.
## sample3 3 2
1 1 2 2
2 2 3 3
1 1 0
1 2 1
0 1 1
</p>