DP Solution for USACO 2021 December Problem 3: Walking Home

http://www.usaco.org/index.php?page=viewproblem2&cpid=1157

The editorial suggests that it is possible to use grid DP to solve this but I can’t figure it out. Does anyone know how to do it?

1 Like

dp[row][col][current direction][# direction changes so far]