Can someone please explain elaborately distributing dp. I found it in the editorial of atcoder problem Leaping Tak. Given below is the editorial link : https://atcoder.jp/contests/abc179/editorial/133

Thanks in advance :)

# | User | Rating |
---|---|---|

1 | tourist | 3778 |

2 | Benq | 3592 |

3 | ecnerwala | 3521 |

4 | Um_nik | 3423 |

5 | jiangly | 3375 |

6 | Petr | 3342 |

7 | Radewoosh | 3337 |

8 | scott_wu | 3313 |

9 | maroonrk | 3265 |

10 | yosupo | 3259 |

# | User | Contrib. |
---|---|---|

1 | Errichto | 201 |

2 | 1-gon | 200 |

3 | rng_58 | 194 |

4 | SecondThread | 193 |

5 | awoo | 187 |

6 | vovuh | 183 |

7 | Um_nik | 182 |

8 | antontrygubO_o | 177 |

9 | Ashishgup | 175 |

10 | -is-this-fft- | 171 |

Can someone please explain elaborately distributing dp. I found it in the editorial of atcoder problem Leaping Tak. Given below is the editorial link : https://atcoder.jp/contests/abc179/editorial/133

Thanks in advance :)

↑

↓

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jan/21/2021 21:41:56 (i2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

could anyone provide all the atcoder contests with editorials

Distributing DP means that you take information about the current state, and pass it to future states.

Receiving DP means that you take information from previous states.

For example, if you're implementing a DP solution for finding the Fibonacci numbers, you could do either one:

thanks a lot mate for giving the reply and ur time besides some people waste time downvoting others .

If I understand correctly, does this mean that distributing DP couldn't be used in top down DP?

Distributing dp is also often referred to as push dp, and receiving dp is also called pull dp.

To briefly go over the differences between them, let's consider this problem.

In both methods, our definition of dp is the same, $$$ dp[x] = \text{minimum number of coins required to make value x} $$$

Push dpFor push dp, you push results from currently available results.

so, if you consider adding coin with value $$$ c $$$ to your knapsack, and considering you already have the optimal value for some $$$ x $$$ in $$$ dp[x] $$$

then, from using $$$ dp[x] $$$ coins to make value $$$ x $$$, you can transition to, using $$$ dp[x]+1 $$$ coins to make value $$$ x+c $$$,

more programatically, we update $$$ dp[x+c] = min( dp[x+c], dp[x] + 1 ) $$$.

Notice how we "pushed" from an already computed value $$$ dp[x] $$$ to $$$ dp[x+c] $$$.

Pull dpFor pull dp, you pull results for the current state, from previously computed results.

you want to consider computing $$$ dp[x] $$$, let's say the last coin used to get to the current state was of value $$$ c $$$, then your update looks like, $$$ dp[x] = min( dp[x], dp[x-c] + 1 ); $$$

Here, you pull the results from already computed value of $$$ dp[x-c] $$$.

Additional Note: If you think about these methods, you realise the importance about order of processing. If the dp for your current state is not optimally calculated, and you push from there, and later optimally compute the dp for the state, then you can see that you would probably not get the optimal overall result. Thus, it leads you to the idea of a topological ordering of states, according to dependence on other states' results.

thanks a lot