You are given an integer n denoting the number of cities numbered from
Initially, there is a directed road from city i to city
You are also given a queries, where each queries[i] u_i to city v_i.
After adding each road, determine the length of the shortest path from city
Return an array ans where ans[i] is the length of the shortest path from city
Constraints:
n
queries.length
queries[i].length
queries[i][0] queries[i][1] n
queries[i][1] queries[i][0]
There are no repeated roads among the queries.
You are given an integer n denoting the number of cities numbered from
Initially, there is a directed road from city i to city
You are also given a queries, where each queries[i] u_i to city v_i.
After adding each road, determine the length of the shortest path from city
Return an array ans where ans[i] is the length of the shortest path from city
Constraints:
n
queries.length
queries[i].length
queries[i][0] queries[i][1] n
queries[i][1] queries[i][0]
There are no repeated roads among the queries.