Raymond And Network
All submissions for this problem are available.As we all know, Raymond Redington of blacklist is one of the most wanted criminals by the FBI.
He has his own vast network which he uses to safely travel from one city to another without being caught.
You are a secret agent who has got hold of the network and wants to catch Raymond before he commits another crime.
The network consists of n cities and m bidirectional roads connecting them.
He can always go from any one city to another using some set of roads.
Let us define a road X between a pair of cities A and B as special such that if this road is deleted, there is no other way to reach from city A to city B.
After getting the network, you have the details of his Q days plan, in which he is going to travel from city A to city B.
For every query, you have to tell the number of special roads which lie on the shortest path between city A to city B.
- The first line contains N, M, and Q.
- Each of the next M lines contain a pair of integers A and B, denoting a road between A and B.
- Each of the next Q lines contain two integers denoting the astarting and the ending city.
- For each query, print the required answer in one line.
8 9 4
|Tags||bridges, insomnia, insq16, lca, meintoo, mnnit|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYP3|
Fetching successful submissions
If you are still having problems, see a sample solution here.