← All problemsSign in

Shall we play a game

CodeChefRating 1361Open on judge ↗

Alice and Bob play a game over $N$ rounds, starting with an initial score of $0$. Alice takes the first turn. In the $i_{th}$ round ($1 \leq i \leq N$), the current player must either add or subtract $2^{i-1}$ from the current score. As the game progresses, let: - $X$ be the maximum score reached at any point. - $Y$ be the minimum score reached at any point. Alice’s goal is to minimize the fin

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