← All problemsSign in

A-B Game

CodeChefRating 2366Open on judge ↗

Two players (let's call them A and B) are playing a game on a row of cells. A cell may contain the character 'A', contain the character 'B' or be empty. Each character may only be moved from a cell $c_i$ to a cell $c_f$ if cell $c_f$ and all cells between $c_i$ and $c_f$ are currently empty. The leftmost (first) character may only be moved to the right, the second character may only be moved to th

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