← All problemsSign in

A Bit Easy

CodeChefRating 2256Open on judge ↗

Chef was impressed by an array $A$ of $N$ non-negative integers. But, he was asked to solve the following problem in order to get this array. Given a non-negative integer $k$, find the number of pairs $(i, j)$ $(1 \leq i < j \leq N)$ such that the following condition holds true: $(A_i$ $|$ $A_j)$ $+$ $(A_i \oplus A_j)$ $+$ $(A_i$ $\&$ $A_j)$ $= k$ $+ A_j$, where - $(A_i | A_j)$ denotes [Bitwis

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