Maximum sum
CodeChefOpen on judge ↗
You are given a 2D matrix $mtr$ with $n$ rows and $m$ columns containing only integers. You can perform an operation on this matrix any number of times (possibly 0), in each operation you have to perform the following two steps. - Choose any two elements $mtr[i_1][j_1]$ and $mtr[i_2][j_2]$ such that $|i_1-i_2|\leq 1$, $|j_1-j_2|\leq 1$ and $|i_1-i_2|+|j_1-j_2|\geq 1$. - Set $mtr[i_1][j_1] = -mtr[i
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start