Python 3 implementation to find the number of ways to paint K cells of 3 x N grid such that No two adjacent cells are painted
mod = 1e9 + 7 NEW_LINE MAX = 301 NEW_LINE MAXP = 3 NEW_LINE MAXK = 600 NEW_LINE MAXPREV = 4 NEW_LINE dp = [ [ [ [ - 1 for x in range ( MAXPREV + 1 ) ] for y in range ( MAXK ) ] for z in range ( MAXP + 1 ) ] for k in range ( MAX ) ] NEW_LINE