← All problemsSign in

Chococut

CodeChefRating 1003Open on judge ↗

Alice has a rectangular bar of chocolate of dimensions $N\times M$. The bar is made up of $N\cdot M$ smaller $1\times 1$ squares. Unfortunately, Alice has to share part of the chocolate with Bob. **At most once**, Alice can break the rectangular bar into two smaller rectangles, either by making a vertical cut or a horizontal cut. She'll then give one of the pieces to Bob, and keep the other for

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