Grid Illumination
Count lamps on each row, column and diagonal so each query is answered in constant time, then switch off the 3x3 block around it.
Count lamps on each row, column and diagonal so each query is answered in constant time, then switch off the 3x3 block around it.