Path Existence Queries in a Graph II

Solution Code
Verifying access...

Time Complexity

O((N + Q) log N)

Space Complexity

O(N log N)