rgame27's blog

By rgame27, history, 3 years ago, In English,

This is my attempt at the question:


As I couldn't see the test case for which it is failing I was scrolling through other solutions and found 1 that is very similar, but that has passed. Any help with telling me why mine fails?

Similar solution that passes: http://codeforces.com/contest/793/submission/27902199

  • Vote: I like it
  • -2
  • Vote: I do not like it

3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Here is a test case your code fail:

3 4

basically, you are checking whether a grid is visited or not, but not the direction in which it is travelling. So you will need 1 more dimension for the direction. (something like v[i][j][dir] instead)