Company: Google_25oct
Difficulty: medium
Matrix queries Problem Description You are handed an N x M binary matrix, meaning every cell holds either a 0 or a 1, and you must process Q queries against it. Each query takes the form (x 1 , y 1 , x 2 , y 2 ) with x 1 ≤ x 2 and y 1 ≤ y 2 . Gather every cell (x, y) satisfying x 1 ≤ x ≤ x 2 and y 1 ≤ y ≤ y 2 , and flip each of their values, turning a 1 into 0 and a 0 into 1. In other words, invert every cell lying inside the rectangular block bounded by (x 1 , y 1 ) and (x 2 , y 2 ). After all Q queries have been applied, report how many cells still hold their original value. Input Format The first line contains an integer T denoting the number of test cases. The first line of each test case contains an integer N. The second line of each test case contains an integer M. Next N lines of each test case contain M space-separated integers denoting the binary matrix. The next line of each test case contains an integer Q. Next Q lines contain 4 space-separated integers den