#Help me with this logic.

2 messages · Page 1 of 1 (latest)

primal arrow
#

Elavenil has a chessboard with N rows and M columns. In one step, he can choose two cells of the chessboard which share a common edge (that has not been cut yet) and cut this edge.
Formally, the chessboard is split into two or more pieces if it is possible its cells into two non-empty subsets S1 and S2 (S1 Intersection S2 != null, |S1| + |S2| = NM ) such that there is no pair of cells c1,c2 (c1 belongs S1, c2 belongs S2) which share a common edge that has not been cut.
Elavenil does not want the board to split into two or more pieces. Compute the maximum number of steps he can perform while satisfying this condition, 1<= N,M<=8

sharp tendon
#

what problems are you having with it