← All problemsSign in

XOR, The Detective

CodeChefRating 2839Open on judge ↗

There are some hidden non-negative numbers $A$ and $B$, with $0 \leq A \lt B \lt 2^{29}$. You were not able to determine them and were gonna cry. Luckily, XOR The Detective decided to save your day! XOR The Detective is a great interrogator. In one query, he can ask any integer $X$ such that $0 \le X < 2^{30}$, and learn the value of $(A + X) \oplus (B + X)$. Here $\oplus$ denotes the [bitwise XO

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