← All problemsSign in

Lexicographic Detective

CodeChefRating 3373Open on judge ↗

You have an $N \times N$ character matrix $A$ composed of lowercase letters, but you have forgotten the matrix. Fortunately, you still remember $N^2$ strings $S_{ij}$ ($1 \leq i,j \leq N$) of length $N$, and an $N \times N$ integer matrix $B$ . For all $1 \le i,j \le N$: - If $B_{ij}=0$, $S_{ij}$ represents the string with the **smaller** lexicographical order between the string represented by

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