DP M
https://gyazo.com/7f00d3569b97262049eab2547f73d1ad
Distribution Counting Issues
Heavy addition at DP confluence.
Rustic solution, this will pass all samples except the last.
code:python
def solve(N, K, XS):
for i in range(1, N):
v = 0
for j in range(K + 1):
v = 0
if j - k < 0:
break
v %= MOD
table = newtable
What's wrong with simple is the addition loop, so find the cumulative sum in advance.
code:python
def solve(N, K, XS):
for i in range(1, N):
v = 0
acc = 0
for j in range(K + 1):
for j in range(K + 1):
if k >= 0:
table = newtable
---
This page is auto-translated from /nishio/DP M. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.