Interesting problem from codechefs rounf 189

Правка en1, от BLUmOOn, 2025-06-04 19:56:33

problem So i know the solution is dp with 2 choices for index j in array for value i,closest left to j and closest right to j,but my query is if i don't choose optimally and instead choose m1= max value of (p+dp[i-1][p]) for p>j and m2=max value of (p-dp[i-1][p]) for p<j and then update dp[i][j]-max(m1,m2) will that also work?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский BLUmOOn 2025-06-04 19:56:33 431 Initial revision (published)