← All problemsSign in

Same And

CodeChefRating 1677Open on judge ↗

You are given two non negative integers $N$ and $M$ $(N<M)$. A beautiful sequence is defined as a sequence $S = \{X_1, X_2, \dots, X_K\}$ of distinct non-negative integers, each at most $M$, that satisfies the following properties: - For all $1 \leq i \leq K$, we have $0 \leq X_i \leq M$. - For all $1 \leq i < j \leq K$, $X_i \neq X_j$. - For all $1 \leq i < j \leq K$, $X_i \& X_j = N$, where $\&

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