Question: In Python3: There is a board (matrix). Every cell of the board contains one integer, which is 0 initially. The following operations can be applied
In Python3:
There is a board (matrix). Every cell of the board contains one integer, which is 0 initially. The following operations can be applied to the Query Board: SetRow i x: change all values in the cells on row "i" to value "x". SetCol j x: change all values in the cells on column "j" to value "x". QueryRow i: output the sum of values on row "i". QueryCol j: output the sum of values on column "j". The board's dimensions are 256x256. "i" and "j" are integers from 0 to 255. "x" is an integer from 0 to 31.
Input:
Your program should read lines from standard input. Each line contains one of the above operations.
Output:
For each query, output the result of the query.
Test
SetCol 32 20
SetRow 15 7
SetRow 16 31
QueryCol 32
SetCol 2 14
QueryRow 10
Output
5118
34
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
