Блог пользователя I_m_sfg

Автор I_m_sfg, история, 8 часов назад, По-английски

You have an array of length n and can start at any index. In one operation, you can move either left, right, or stay at your position to pick the value arr[i].After picking the value, increase all the elements in the array by 1. Find the maximum sum you can get after performing k operations.

Теги c++, dp
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
8 часов назад, # |
Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

I guess its dp[K+1][N]. With transition as dp[i+1][j-1]+=arr[j]+k;dp[i+1][j+1]+=arr[j]+k; But you ofc need to check boundaries.