suggi_d_luffy's blog

By suggi_d_luffy, history, 9 years ago, In English

problem link : ABCPATH solution link : Solution Not understanding why the two const int arrays dx,dy are taken and also preempted with certain specific values(0,-1,1).

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
  Vote: I like it +2 Vote: I do not like it

Crypto Cup 2.0 soon

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Have you tried a naive algorithm to solve the problem? The values are just 8 directions that you can move from any cell. (row + dy[i], col + dx[i]) for all values of i from 0 to 7. And the solution uses dynamic programming. But I think you should try a recursive one which will look similar to dfs. And then try memoizing it and after that you could make it iterative.