← All problemsSign in

Counting Subsequences

CodeChefRating 2636Open on judge ↗

An array of size $M$ is called **good**, if, for each pair of integers $(i, j)$ $(1 \leq i \lt j \leq M)$: - $A_i | A_j = (A_i\oplus A_j) + A_j$, where $|$ denotes [bitwise OR operator](https://en.wikipedia.org/wiki/Bitwise_operation#OR) and $\oplus$ denotes [bitwise XOR operator](https://en.wikipedia.org/wiki/Bitwise_operation#XOR). Note that an array having a single element $(M = 1)$ is also **

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