← All problemsSign in

dragon matrix

Problem description. An NXM matrix is called a dragon matrix if: - It contains all the elements in range [1,NXM]exactly once. - For any 2 elements (i1j1) & (i2j2) : i1+j1i2+j2 then Ai1,j1Ai2,j2 should hold. - Input Input description. Two space separated integers NandM Output Output description. Print the total number of humble matrices possible, modulo 109+7 Constraints - 1 ≤ N,M ≤ 1

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