In Part 1, I adopted the route search algorithm A*(A star). The workflow finishes in about 1 minute.
In Part 2, after a lot of trial and error, I used an iterative macro to search from the end of the memory corruption list for the point where I finally reached the goal. The route-finding algorithm was much faster in unreachable cases, and was able to find the answer within three minutes.
Part1 macro(A* algorithm)
Part 2 macro