War in the Wizarding World

Limits: 1s, 512 MB

There is a deadly war going on between two countries (Bitland and Byteland) in the wizarding world. They are fighting with each other in a large forest. There are some strategically important places in the forest known as Hubs. They have numbered all the Hubs with numbers 1 to n. There are roads in the forest where each road connects two Hubs. The army of Bitland want to reach Hub n starting from Hub 1 by travelling shortest possible distance. They also know that there is at most one road between any two hubs and found the shortest path from Hub 1 to n.


This is a companion discussion topic for the original entry at https://toph.co/p/war-in-the-wizarding-world