Dp problem Vacation AtCoder

What is the exact use of dp array ? I am confused…

it stores the best possible state uptil this point, as in before picking an activity on the ith day, what is best possible happiness on the i-1th day and then on the ith day we will pick accordingly