#P9198. Symmetric Image Check
Symmetric Image Check
Symmetric Image Check
You are given an image of n rows and m columns. The image is represented as a matrix of pixels. Initially, every pixel is black with RGB value \((0,0,0)\).
There will be q operations. In each operation, you are allowed to change one of the three components (R, G, or B) of a single pixel. In particular, an operation is described by four values: i j c x
, where i
and j
indicate the row and column of the pixel (1-indexed), c
indicates which component to modify (1 for R, 2 for G, 3 for B), and x
is the new value for that component.
After every operation, you must check whether the image is left-right symmetric. An image is left-right symmetric if for every row \(i\) and every column \(j\), the pixel at \( (i,j) \) has the same RGB value as the pixel at \( (i, m-j+1) \). In mathematical terms, for any valid \(i, j\): \[ \text{pixel}(i,j) = \text{pixel}(i, m-j+1). \]
Output Yes
if the image is symmetric after an operation, or No
if it is not.
inputFormat
The first line contains three integers \(n\), \(m\), and \(q\) representing the number of rows, columns, and the number of operations, respectively.
Each of the following \(q\) lines contains four values: i j c x
, where \(i\) and \(j\) (1-indexed) identify a pixel, \(c\) is an integer in \(\{1,2,3\}\) representing the RGB component (1 for R, 2 for G, 3 for B), and \(x\) is the new value for that component.
outputFormat
For each operation, output a line containing either Yes
if the current state of the image is left-right symmetric, or No
otherwise.
sample
2 2 3
1 1 1 5
1 2 1 5
2 1 3 100
No
Yes
No
</p>