static void Main(string[] args) { string[] line = Console.ReadLine().Split(' '); int V = int.Parse(line[0]); country map = new country(V); Dictionary <string, city> dict = new Dictionary <string, city>(); for (int i = 0; i < V; i++) { line = Console.ReadLine().Split(' '); city c = new city(i, int.Parse(line[1])); dict.Add(line[0], c); } line = Console.ReadLine().Split(' '); int E = int.Parse(line[0]); for (int i = 0; i < E; i++) { line = Console.ReadLine().Split(' '); map.addRoad(dict[line[0]].v, dict[line[1]].v, dict[line[1]].cost); } line = Console.ReadLine().Split(' '); int t = int.Parse(line[0]); string[] results = new string[t]; for (int i = 0; i < t; i++) { line = Console.ReadLine().Split(' '); int cost = map.sortestPath(dict[line[0]].v, dict[line[1]].v); if (cost == 20000001) { results[i] = "NO"; } else { results[i] = cost.ToString(); } //Console.WriteLine(cost); } for (int i = 0; i < t; i++) { Console.WriteLine(results[i]); } Console.Read(); }