Cubes and Coins
CodeChefOpen on judge ↗
Chef and Chefina have decided to play the game of cubes and coins. There are $N$ cubes placed in a straight line numbered $1$ through $N$. The $i$-th cube has a point $P_i$ associated with it. Each player takes alternate turns and proceeds as follows - - If only a single cube is left, player picks it. - Otherwise, he/she tosses an unbiased coin. If the coin lands on heads, player takes the first
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.
Sign in to chat with the tutor and save your progress.
Sign in to start