← All problemsSign in

Completion (Easy)

CodeChefRating 2314Open on judge ↗

**This is the easy version of the problem. Here, it is guaranteed that $P_{2i} = 0$ for all $i$.** You are given a permutation$^\dagger$ $P$ of the integers $1$ to $2N$, with some of its elements missing (represented by $0$'s). Find the number of ways of filling in the zeros to obtain a valid permutation, such that the quantity $$ |P_1 - P_2| + |P_3 - P_4| + \ldots + |P_{2N-1} - P_{2N}| $$ is

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