Strange Matrix
Given two matrices A and B. Both have N rows and M columns. In the matrix A, numbers from 1 to MN have been written in row major order. Row major order numbers cells from left to right, and top to bottom. That is, 1 2 3 ... M A = M+1 M+2 M+3 ... 2M 2M+1 2M+2 2M+3 ... 3M . . . ... . . . . ... . (N-1)M+1 (N-1)M+2 (N-1)M+3 ... NM Similarly, in the matrix B, numbers from 1 to MN have been written in
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