Dynamic programming question

question -> Contest Page | CodeChef
my submmision -> Solution: 41986778 | CodeChef

why am i getting partial ac? if anybody can explain.

thanks in advance :pray: