← All problemsSign in

Make Permutation

CodeChefRating 1200Open on judge ↗

Chef has an array $A$ of size $N$. He wants to make a permutation$^{\dagger}$ using this array. Find whether there exists an array $B$ consisting of $N$ non-negative integers, such that the array $C$ constructed as $C_i = A_i + B_i$ is a permutation. $^{\dagger}$ A permutation of size $N$ is an array of $N$ distinct elements in the range $[1, N]$. For example, $[4, 2, 1, 3]$ is a permutation of

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