← All problemsSign in

Two Cards

CodeChefRating 1553Open on judge ↗

Alice and Bob have $N$ cards with them. The $i$-th card has the number $A_i$ written on its front, and $B_i$ written on its back. It's guaranteed that $A_i \neq A_j$ for $i \neq j$, i.e, all the $A_i$ values are distinct. All the cards are face-up, so only their $A_i$ values are visible. Alice will choose exactly one card from the $N$ cards, and remove it. After Alice has chosen her card,

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