Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Process queries in reversed order, as the latest queries represent the most recent changes in the matrix.
Once you encounter an operation on some row/column, no further operations will affect the values in this row/column. Keep track of seen rows and columns with a set.
When operating on an unseen row/column, the number of affected cells is the number of columns/rows you haven’t previously seen.