How to solve Avoiding Airports ?

Avoiding Airports Can’t figure out a time-efficient solution. Tried to write shortest path logic with Dijkstra but it gave time limit exceeded. Most likely because at some node X if the flight is at T1 then I need to wait from CurrentTime - T1 which would increase my frustration so I would like to go around in loops if possible till T1 and reach back X just in time. This seems like a DP. But looking at the constraints it’s kinda unlikely.

Can someone provide a reasonable solution?

Here’s my code for the Dijkstra approach here

This might help: link

Can you help with dp I am finding it hard to formulate @meooow