How to solve this using recursion (TLE in TADELIVE)


What states are save for memorization…
I got tle on this submission.
link - https://www.codechef.com/viewsolution/30395014
@ tmwilliamlin @ssjgz

This is actually a greedy algorithm. Sort by difference in tips, and greedily allocate the jobs, and make sure that one person doesn’t get more than their max orders.

1 Like

Thanks, but in editorial they give both the solution greedy as well as dp but in dp , my question is in memorization they use 2-d array but due to constraints this is not possible and when I use map i got tle means memorization is not correct in my case.