← All problemsSign in

Permutation Filling

CodeChefRating 2613Open on judge ↗

The score of a permutation $P$ of integers $[1, N]$ is defined as follows: $$\sum_{L = 1}^{N} \sum_{R = L}^{N} \text{MEX}(P[L, R])$$ where $P[L, R]$ denotes the subarray $[P_L, P_{L + 1}, P_{L + 2}, \ldots, P_R]$ and $\text{MEX}(A)$ represents the minimal non-negative integer not present in $A$. --- You are given a partially filled permutation $Q$, i.e. $Q$ is formed by replacing some (possibl

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