Блог пользователя i_am_bug

Автор i_am_bug, история, 6 лет назад, По-английски

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

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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.