← All problemsSign in

MEXimal Moving

CodeChefRating 2668Open on judge ↗

You're given an array $B$ of length $N$. You also have an array $A$ of length $2N$. Initially, $A_i = 0$ for all $1 \le i \le 2N$. Using the array $B$, you will modify the array $A$ as follows: - For each $i = 1, 2, 3, \ldots, N$ **in order**, do the following. - First, choose an index $j$ ($1 \le j \le 2N$) such that $A_j \le B_i$. Such an index will always exist. - Then, increment $A_j$ by

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