← All problemsSign in

Set Size

CodeChefRating 1583Open on judge ↗

You are given an array $A$ of $N$ integers - $[A_1, A_2, \ldots, A_N]$. For a positive integer $X$, consider the set $S_X$ defined as $\{A_i + j$ $|$ $1 \le i \le N, 1 \le j \le X\}$, i.e. the elements added in this set will be $\{A_1 + 1, A_1 + 2, \ldots, A_1 + X, A_2 + 1, A_2 + 2, \ldots, A_2 + X, \ldots, A_N + 1, A_N + 2, \ldots, A_N + X\}$. Then, we are interested in the value $|S_X|$, i.e.

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