← All problemsSign in

Missing Sums

CodeChefRating 1374Open on judge ↗

Given a positive integer $N$, construct an array $A$ containing $N$ $\textbf{distinct}$ elements such that the sum of any two elements in the array (not necessarily different) is not present in the array. That is, there have to be $\textbf{no}$ such $i, j, k$ such that - $1 \le i, j, k \le N$ - $A_i + A_j = A_k$. The elements of the array $A$ should be in the range $[1, 10^5]$. It is guarante

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