Why so many downvotes? What's wrong with the post?
Problem Link: https://atcoder.jp/contests/abc220/tasks/abc220_d
Their official editorial has a bottom-up solution.
I have understood and solved it with the bottom-up approach. I was just curious how would top solution will look like for this problem?
- I tried, but there seems that I have to invert the modulo operator in here to get to the top-down solution.
- the dp states and the base case look intuitive, the DP call is not so much.
Found One: https://atcoder.jp/contests/abc220/submissions/26150901
Please enlighten me, if I am missing something in here.