← All problemsSign in

Minimise the Size

CodeChefRating 2059Open on judge ↗

Consider an array $A = \{a_1, a_2,...,a_n\}$ of size $n \geq 1$. If $a_k = 2^x -1$ for all $ 1\leq k \leq n$, for some integer $x$ $(1 \leq x \leq 60)$, then $A$ is called $interesting$ $array$. You are given a number $C$. Find any $interesting$ $array$ $A$ of minimum possible size such that $ a_1 \bigoplus a_2 \bigoplus...\bigoplus a_n = C$, where $\bigoplus$ represents bitwise XOR operation.

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