PalForce's blog

By PalForce, history, 6 years ago, In English

Avoiding Airports How to solve avoiding airports. I wrote a shortest distance approach using dijkstra but gives TLE. How to avoid going in loops to catch some flight at a particular node that leads to the destination. Can someone give a solution to this problem.

  • Vote: I like it
  • +5
  • Vote: I do not like it

| Write comment?
»
6 years ago, # |
  Vote: I like it +5 Vote: I do not like it

There will be no loops because you always catch a flight which is in future. So make a DP tracking last edge used and use convex hull trick(per node) for transitions.