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

Автор apnakaamkar, история, 6 лет назад, По-английски

Could anyone please exlain me how to solve this dp problem? Link:https://atcoder.jp/contests/dp/tasks/dp_n Help?

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

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Check this out... https://www.codechef.com/JULY19B/problems/CIRMERGE/

It also has a nice editorial.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Its easier to understand the recurrence relation from a solution done made with recursion (and memoisation), so here you go — https://atcoder.jp/contests/dp/submissions/15834404

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

this video by Errichto helped me a lot while solving the dp atcoder contest : https://www.youtube.com/watch?v=FAQxdm0bTaw&t=8731s

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is there anything I am missing? If someone can help ?

Link : My solution

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Am i missing something in this solution: https://atcoder.jp/contests/dp/submissions/22675988

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

If you want to learn the concept behind this problem then go through Matrix chain multiplication DP, it is a very famous DP problem and has clear explanations(you can check Cormen or any online articles). This N-slimes problem is very similar to that but instead of multiplication, we do addition.

»
9 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

DP say the coset, marge to some grup (l to r ) slimes into one slime . and the final slimes size is sum of all slimes size ," whis make to marge (l to r ) slimes .

when l == r , the cose 0, becouse one slime . now make a for loop for( i = l; i<r; i++) this make make to deferent grup l to i and i+1 to r. find the cost to grup [l,i] and [i+1,r] and add the final slimes size [l,i] -> one slime whis size sum of all slime l to i. solv(): if l == r return 0; for( l to r-1 ) min[ sum l to i( final slime size l to i grup ) + sum i+1 to r + solv(l,i)[ cost to make one slime frome [l ,i ] grup ] + solv( i+1, r); ]