Range Dp

Правка en1, от avinash007, 2021-05-27 09:11:32

You are given N marbles in different colors. You have to remove marbles till there are no marbles left. Each time you can choose continuous marbles with the same color, remove them and get k*k points. Find the maximum points you can get.

1 ≤ N ≤ 100 0 ≤ Ai ≤ 100

INPUT 6 4 3 1 1 4 2 OUTPUT 10

Remove 1, then 3, then 4 and 2, we get 2*2+1*1+2*2+1*1 = 10

Please provide link to similar Problems.

Also I would like to know your dp states and Transitions

Теги dp, problem

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский avinash007 2021-05-27 09:11:32 487 Initial revision (published)