← All problemsSign in

Binary Board

CodeChefRating 2742Open on judge ↗

Chef loves single-colored squares, so he got a rectangular board with size $N \times M$ consisting only of black cells and white cells. He calculates the *cost* of the board in the following manner: - Let's denote the number of ways to choose $k^2$ white cells which form a square with edge length $k$ (and edges parallel to the borders of the board) by $W_k$. For example, a $2 \times 3$ board consi

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