← All problemsSign in

Distinct Dilemma

CodeChefRating 1420Open on judge ↗

You are given an array $A$ of $N$ integers. You can do the following two types of operations any (possibly zero) number of times: - Pick two indices $i$ and $j$ $(1 \leq i,j \leq |A|, i \neq j)$. Change $A_j := A_j + A_i$ and remove the $i^{th}$ element from the array. - Pick an index $i$ $(1 \leq i \leq |A|)$. Split $A_i$ into two **positive** integers $X$ and $Y$ such that $X+Y=A_i$. Remove the

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