#K75432. Grid Increment Operations
Grid Increment Operations
Grid Increment Operations
You are given a grid with (n) rows and (m) columns initially filled with zeros. You are also given (k) operations. Each operation is defined by four integers (r_1), (c_1), (r_2), and (c_2) which represent the top-left and bottom-right corners of a subgrid. For every operation, increment each element in the specified subgrid by 1.
All indices are 1-indexed. Your task is to output the final state of the grid after performing all operations.
inputFormat
The first line contains three integers (n), (m), and (k). Each of the next (k) lines contains four integers (r_1), (c_1), (r_2), and (c_2) describing an operation.
outputFormat
Output (n) lines. Each line should contain (m) integers separated by a space, representing the final state of the grid.## sample
3 3 2
1 1 2 2
2 2 3 3
1 1 0
1 2 1
0 1 1
</p>