Chef and the Stones
CodeChefOpen on judge ↗
Chef has two piles of stones with him, one has N1 stones and the other has N2 stones. Fired up by boredom, he invented a game with the two piles. Before the start of the game Chef chooses an integer m. In the j-th move: He chooses a number X[J] such that 1 ≤ X[j] ≤ M, and removes X[J] stones from both the piles (this is only possible when both the piles have ≥ X[J] stones). The number chosen m
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