i_am_bug's blog

By i_am_bug, history, 6 years ago, In English

problem-https://cses.fi/problemset/task/1193/ code-Your text to link here... Time Limit exceed

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

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

By looking at your code I guess you are visiting the same cell many times to find the shortest path from A to B and it is causing TLE. You can use the bfs to find the shortest path easily without visiting the same cell many times.