#P13763. [CERC 2021] Airline
[CERC 2021] Airline
题目描述
An airline company offers regular flights involving different airports. Each flight links two airports directly (i.e. without stopping at any other airport) and allows travel in both directions. The flights are arranged such that for any choice of starting airport and destination airport , there exists exactly one sequence of flights between the two airports without visiting any airport more than once. The number of flights in this sequence is called the distance between and .
Were the airline to add another flight, say between airports and , it is possible that for some pairs , another, shorter sequence of flights from to would form. The more pairs affected, the more promising the new connection between and is considered to be. The airline is asking you to help them evaluate several possible additions with respect to this criterion.
输入格式
An airline company offers regular flights involving different airports. Each flight links two airports directly (i.e. without stopping at any other airport) and allows travel in both directions. The flights are arranged such that for any choice of starting airport and destination airport , there exists exactly one sequence of flights between the two airports without visiting any airport more than once. The number of flights in this sequence is called the distance between and .
Were the airline to add another flight, say between airports and , it is possible that for some pairs , another, shorter sequence of flights from to would form. The more pairs affected, the more promising the new connection between and is considered to be. The airline is asking you to help them evaluate several possible additions with respect to this criterion.
输出格式
Output lines; in the -th line, output the number of pairs such that and the distance between airports and would decrease if the original network of flights were supplemented by a direct flight connection between the airports and .
8 2
1 5
5 2
7 3
3 8
6 4
4 5
6 3
5 7
2 6
10
4
提示
Input limits
- , where is the distance between and in the original flight network.