← All problemsSign in

Chef Cooks Permutation

CodeChefRating 2808Open on judge ↗

Chef is bored cooking his regular dishes, so he decided to cook permutations instead. Since this is his first time cooking permutations, he takes some help. Chef has two permutations $A$ and $B$, each of size $N$. Chef cooks a permutation $C$ of size $N^2$ by doing the following: ``` for i = 1 to N: for j = 1 to N: C[i + (j-1) * N] = A[i] + (B[j] - 1) * N ``` Chef is allowed to make

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