Recurrence Relation Doubt in DP

Правка en1, от jhjfbsbfkbjfnfnfjfj, 2020-04-03 10:41:22

Hello everyone, I have been having a lot of problem in solving this question and I have been looking for any help.

https://mirror.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?

Теги #dynamic programing, #dp

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский jhjfbsbfkbjfnfnfjfj 2020-04-03 10:41:22 887 Initial revision (published)