← All problemsSign in

Distinct Rows in Submatrices

CodeChefRating 2607Open on judge ↗

Let's define the *strength* of a matrix as the number of distinct rows in it. Two rows $a_1, a_2, \dots, a_n$ and $b_1, b_2, \dots, b_n$ are distinct if there is an index $i$ such that $a_i \neq b_i$. You are given an integer matrix $A$ with $N$ rows (numbered $1$ through $N$) and $M$ columns (numbered $1$ through $M$). A submatrix of $A$ is formed as the intersection of rows $r_1$ through $r_2$

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start