Arithmetic Expression

Problem : ARITHEXP Problem - CodeChef

My Solution : CodeChef: Practical coding for everyone

Why this dp solution is giving TLE