#P1399. [NOI2013] 快餐店

    ID: 393 远端评测题 2000ms 500MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>递推2013线段树NOI 系列深度优先搜索,DFS环套树,基环树

[NOI2013] 快餐店

Description

Xiao T plans to open a delivery fast food restaurant in city C. The time to deliver to a location is proportional to the length of the shortest path from the restaurant to that location. Xiao T wants to choose a location that minimizes the distance to the farthest customer.

Customers are located in NN buildings in city C. These NN buildings are connected by exactly NN bidirectional roads. No two roads connect the same pair of buildings. Between any two buildings, there exists at least one path formed by bidirectional roads. The restaurant can be placed at any building, or at any point on any road (the distances from that point to the two endpoints of the road do not need to be integers).

Given the map of city C (the road layout and lengths), find the optimal location for the restaurant and output its distance to the farthest customer.

Input Format

The first line contains an integer NN, representing the number of buildings in city C. There are also exactly NN bidirectional roads.

The next NN lines each contain 33 integers, Ai,Bi,LiA_i,B_i,L_i (1iN1\leq i\leq N, Li>0L_i>0), indicating that there is a road between buildings AiA_i and BiB_i with length LiL_i.

Output Format

Output a single real number, rounded and kept to exactly one decimal place, representing the distance from the optimal restaurant location to its farthest customer.

Note: Your result must have exactly one digit after the decimal point. An incorrect number of decimal places will receive no credit.

4 
1 2 1 
1 4 2 
1 3 2 
2 4 1

2.0 
5
1 5 100
2 1 77
3 2 80
4 1 64
5 3 41
109.0

Hint

  • Sample Explanation 1.

  • Sample Explanation 2.

  • Constraints:
    • For 10%10\% of the testdata, N80N\leq 80, Li=1L_i=1.
    • For 30%30\% of the testdata, N600N\leq 600, Li100L_i\leq 100.
    • For 60%60\% of the testdata, N2000N\leq 2000, Li109L_i\leq 10^9.
    • For 100%100\% of the testdata, 1N1051\leq N\leq 10^5, 1Li1091\leq L_i \leq 10^9.

Translated by ChatGPT 5