Problem 3243 · Medium

Shortest Distance After Road Addition Queries I

Each new one-way road is added and a breadth-first search from city 0 gives the shortest distance to the last city.

Open the interactive visualisation