Jordi, the architect of a construction company, received a request from a customer for an estimate for the construction of a raceway. According to the raceway design drawing provided, the raceway site is in the form of an N x N square grid, each grid being 1 x 1. In the design drawing, the cells in each grid are filled with 0 or 1, where 0 indicates that the cells are empty and 1 indicates that the cells are filled with walls.The The starting point of the raceway is the (0, 0) space (top left), and the end point is the (N-1, N-1) space (bottom right).
My code consumes lots of running time... my new idea is making an library. key value of(x,y). If BFS arrives at (x,y) first time it saves the cost to reach (x,y). If BFS arrives (x,y) again, and it's cost is compared with value existing. and if it bigger than value, it is not added to BFS how's this idea? i I did not use this idea on code because i'mI'm afraid this would take long time too.
and iAnd I wonder your idea too there is a hint, but iI could not understand it.