#K44842. Image Brightness Adjustment
Image Brightness Adjustment
Image Brightness Adjustment
You are given an image represented as a 2D matrix of integers where each integer represents a pixel's brightness. The image has M rows and N columns. Additionally, you are given Q brightness adjustments. Each adjustment is specified by three integers a, b, and k, which means that for every row i satisfying $$a \leq i \leq b$$ (using 1-indexed rows), you must add k to every pixel in that row. Your task is to output the final image after performing all the specified adjustments.
Note: The pixel values may become negative depending on the adjustments.
inputFormat
The first line of input contains two integers M and N, representing the number of rows and columns of the image, respectively.
The next M lines each contain N integers denoting the initial pixel values of the image.
The following line contains a single integer Q, which is the number of adjustments.
Each of the next Q lines contains three integers a, b, and k, representing an adjustment that adds k to every pixel in rows a to b (inclusive, 1-indexed).
outputFormat
Output the adjusted image as M lines. Each line should contain N space-separated integers which are the pixel values after all adjustments have been applied.
## sample3 3
10 20 30
40 50 60
70 80 90
1
1 2 10
20 30 40
50 60 70
70 80 90
</p>