Comment

avatar username

I think you misunderstood, we can move only to the down or right and thats not about shifts : we already know how many shifts we did and tmp[i] is the ith row AFTER shifts. so we can simply write : tmp[j] = min(tmp[j],tmp[j-1] + a[i][(j+shift)%m]) (if you still did not understand, proof is -> code, you can submit it)

The actual rating of this user is 1473.

Original comment.

Statistics