Skip to main content
deleted 2 characters in body; edited tags
Source Link
toolic
  • 6.3k
  • 4
  • 20
  • 77

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.

p

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 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 did not use this idea on code because i'm afraid this would take long time too.

and i wonder your idea too there is a hint but i could not understand it

p

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 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 did not use this idea on code because I'm afraid this would take long time too.

And I wonder your idea too there is a hint, but I could not understand it.

[Edit removed during grace period]; added 1 character in body
Source Link

[![Road][1]][1]Road

=== [1]: https://i.sstatic.net/59drc.png

p

[![Road][1]][1]

=== [1]: https://i.sstatic.net/59drc.png

Road

p

Tweeted twitter.com/StackCodeReview/status/1326721488825839617
deleted 44 characters in body; edited title
Source Link
Reinderien
  • 65.6k
  • 5
  • 70
  • 190

Finding cheapest route  (turn costs 500, going straight costs 100)

Road [![Road][1]][1]

Long long question;; sorry but thank you!!

=== [1]: https://i.sstatic.net/59drc.png

Finding cheapest route(turn costs 500, going straight costs 100)

Road

Long long question;; sorry but thank you!!

Finding cheapest route  (turn costs 500, going straight costs 100)

[![Road][1]][1]

=== [1]: https://i.sstatic.net/59drc.png

Source Link
Loading