static void Main(string[] args) { var departId = Console.ReadLine(); var arriveeId = Console.ReadLine(); var n = int.Parse(Console.ReadLine()); var graph = new Graph(); graph.Locations = new Dictionary <string, Location>(); for (int i = 0; i < n; i++) { var location = new Location(Console.ReadLine()); graph.Locations[location.Id] = location; } graph.Aretes = new List <Arete>(); var m = int.Parse(Console.ReadLine()); for (int i = 0; i < m; i++) { var arete = new Arete(Console.ReadLine()); arete.Distance = graph.Locations[arete.Start].DistanceFrom(graph.Locations[arete.End]); graph.Aretes.Add(arete); } var result = graph.FindShortestPath(departId, arriveeId); if (result == null) { Console.WriteLine("IMPOSSIBLE"); } else { foreach (var loc in result) { Console.WriteLine(loc.Nom); } } }
static void Main(string[] args) { var departId = Console.ReadLine(); var arriveeId = Console.ReadLine(); var n = int.Parse(Console.ReadLine()); var graph = new Graph(); graph.Locations = new Dictionary<string, Location>(); for (int i = 0; i < n; i++) { var location = new Location(Console.ReadLine()); graph.Locations[location.Id] = location; } graph.Aretes = new List<Arete>(); var m = int.Parse(Console.ReadLine()); for (int i = 0; i < m; i++) { var arete = new Arete(Console.ReadLine()); arete.Distance = graph.Locations[arete.Start].DistanceFrom(graph.Locations[arete.End]); graph.Aretes.Add(arete); } var result = graph.FindShortestPath(departId, arriveeId); if (result == null) { Console.WriteLine("IMPOSSIBLE"); } else { foreach (var loc in result) { Console.WriteLine(loc.Nom); } } }