Escape Room
Problem description here (scroll down).
Solution Code
Approach
The first thing to keep in mind is factoring is slower than multiplying. BFS from backwards (end to start) with multiplication rather than forwards (start to end wth factoring).
The second thing to keep in mind is it would be way too slow to scan through the entire maxtrix each time. At the beginning, while (or after) taking input, map the product and the coordinates. Later use these maps of product to coordinates with that product to reduce the number of iterations through the maze to just once.