← All problemsSign in

Distinct Fun

CodeChefRating 1628Open on judge ↗

You are given an array $A$ of length $N$. In one operation, you may choose a prefix of the array of length $k$ ($1 ≤ k ≤ N$) and an integer $X ≥ 0$, and apply the $bitwise XOR$ operation to all elements in that prefix: - $[ A_i = A_i \oplus X \text{ for all } 1 \le i \le k]$ (Here, $⊕$ denotes [bitwise XOR](https://en.wikipedia.org/wiki/Exclusive_or).) Your goal is to make **all elements of t

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