What is Memoization of given recursive solution of spoj problem DCEPC501 — Save Thy Toys

Правка en1, от VIKRAM91, 2018-05-13 02:17:17

I am doing this problem on Spoj and I have written the recursive solution. Which according to me is right. This solution is giving me TLE, so I change to memoization solution. This memoization solution is giving me WA.

Is my memoization of recursive solution wrong? If yes then why and if no then why is it not giving AC.

Is there any better way to do memoization?

Thank you.

Теги #dp, memoization, #recursion, solution spoj

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский VIKRAM91 2018-05-13 11:30:28 203 Tiny change: ' it's AC. [AC Soluti' -> ' it's AC. \n\n[AC Soluti'
en1 Английский VIKRAM91 2018-05-13 02:17:17 572 Initial revision (published)