Hello everyone, I have been having a lot of problem in solving this question and I have been looking for any help.
https://codeforces.com/contest/505/problem/C This is the question. Can you please help me find the recurrence relation? If you will read the editorial you will find that they have used relation: dp [ i ][ j ] = (the number of the gems on island i ) + max( dp [ i + j — 1][ j — 1], dp [i + j ][ j ], dp [ i + j + 1][ j + 1]), if i < m , j ≥ 2 but in recurrence relation we used to find out the previous state on (right hand side of the equation because that is how we solve sub-problems ) but here they have related dp[i][j] (current state ) with the state that will be achieved afterwards in the process that is dp[i+j+1][j+1], dp[i+j][j] and dp[i+j-1][j-1]. How are we solving sub-problems here? Can you please help me?