← All problemsSign in

Crazy Permutations

CodeChefRating 1408Open on judge ↗

Chef has two permutations $A$ and $B$ of length $N$. Here, a permutation of length $N$ is an array containing each integer from $1$ to $N$ exactly once. Chef wants to transform array $A$ into array $B$ using the following operation any number of times (possibly zero): - Choose an index $k$ ($1 \le k \le N$) and either increase $A_k$ by $1$ or decrease $A_k$ by $1$. However, after every operation

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