Bamboo Art Problem

Can someone help telling what is wrong with mine solution I am printing the 2D dp which is being generated but it does not contains any cell with correct answer. Problem link