QUERIES ON MATRIX
All submissions for this problem are available.$Shreyas$ and $Anupam$ both loves to solve coding problems that are based on matrix. One day $Hritik$ gave a $two -Dimentional$ $N*M$ matrix to them, and asked them to answer $Q$ Queries , Both $Shreyas$ and $Anupam$ were able to solve that problem.Can you? There are two types of Queries in the problem:- $1.)$ $1$ $r$ $c$ $val$ : To change the value at $(r,c)$ to val. $2.)$ $2$ $r1$ $r2$ $c1$ $c2$ : In this type of Query ,for each row in range $[r1,r2]$ (inclusive) , find out maximum of row values that fall in range $[c1,c2]$. After finding all the maximums return the $maximum$ of all the maximums. For eg: - In row $r1$ find out the max element in range $[c1,c2]$ , then for $r1+1 , r1+2 .... r2 $. Now let all the maximums be $ max(r1),max(r1+1),. . . . max(r2) $, return maximum of all the maximums. ###Note $Large$ $input$ $file$. $Use$ $fastio$. ###input format $1.)$ First line of the input contains $T$ ,no of testcases. $2.)$ Second line of the input contains two space separated integers $N$ and $M$. $3.)$ Each of $N$ lines contains $M$ space separated integers , describing the $2-D$ Matrix. $4.)$ Next line contains $Q$ ,number of Queries. $5.)$ Next $Q$ lines contains Queries of type $1$ and $2$ described in the problem statement. ###output format Print the maximum value on the new line. ###Constraints $1\leq T \leq 20$ $1\leq N,M \leq 250$ $1\leq val \leq 10^8$ $1\leq r1 \leq r2 \leq N$ $1\leq c1 \leq c2 \leq M$ $1\leq r \leq N$ $1\leq c \leq M$ $1\leq Q \leq 10^5 $ ###Sample Input $1$ $4$ $4$ $1$ $2$ $3$ $4$ $5$ $6$ $7$ $8$ $9$ $10$ $11$ $12$ $13$ $14$ $15$ $16$ $3$ $2$ $1$ $3$ $1$ $4$ $1$ $2$ $2$ $19$ $2$ $1$ $3$ $1$ $4$ ###Output format $12$ $19$
|Time Limit:||1 - 1.5 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.