← All problemsSign in

Adjacent Pairs

CodeChefRating 2719Open on judge ↗

Let's call an array $B_1, B_2, \ldots, B_M$ **good**, if $B_i \neq B_{i+1}$ for any $i$ with $1 \le i \le M-1$. You are given a **good** array of $N$ positive integers $A_1, A_2, A_3, \ldots, A_N$. You can perform the following operations on this array: - Choose any index $i$ $(1 \leq i \leq N)$ and a number $X$ $(1 \leq X \leq 10^9)$. Then, set $A_i$ to $X$. After this operation, the array h

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