← All problemsSign in

Xorry 1

CodeChefRating 1472Open on judge ↗

You are given an integer $X$. Two integers ($A$, $B$) are said to be an Xorry pair, if the following conditions are satisfied: - $A \oplus B = X$ - $0 \leq A \leq B \leq X$ - Among all the pairs which satisfy the above two conditions, $(B - A)$ is as small as possible For example, suppose $X = 6$.\ Then, the pair $(0, 6)$ satisfies the first two conditions. But, the pair $(2, 4)$ also satisfies

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