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

Автор THE_BOMBE, история, 3 года назад, По-английски

https://atcoder.jp/contests/abc230/tasks/abc230_f

The above url is the link to the problem , i read many blogs but I am confused about why the recursive relation is given by

DP[i]=2*DP[i-1] - DP[j]
where j is the right most index such that sum of subarray from A[j+1] to A[i-1] is zero.

BUT why it is  not 

DP[i]=2*DP[i-1]- SUM(DP[j]) for all j such that sum of subarray from A[j+1] to A[i-1] is zero.

Please also point out some similar questions if you have, Thanks in advance.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится