#P10199. [湖北省选模拟 2024] 时与风 / wind
[湖北省选模拟 2024] 时与风 / wind
Background
The wind brings the seeds of stories, and time turns them into myths.
Problem Description
You are flying among anchor points along directed air routes using the Wings of Wind. The anchor points are numbered , and the directed routes are numbered . For route , the starting anchor point is , and the destination anchor point is .
Due to Barbatos's mysterious connection with time, route opens at time and closes after time . That is, for any , you can enter route from anchor point at time . After entering a route, spatially you will arrive directly at anchor point . Temporally, the time will change with equal probability to a real-valued moment corresponding to some real number in . Note that after arriving at an anchor point, you must immediately enter the next route at the same moment; otherwise, you must end the flight there.
You will start from anchor point and try to visit anchor point . You need to determine a path , where denotes a route. The path must satisfy that starts from anchor point , arrives at anchor point , and for , the destination anchor point of is the same as the starting anchor point of . A path is a stable path if and only if, no matter how the time changes after each route traversal, you can complete the entire path. The arrival time of a stable path is, when traveling to anchor point along this path, the latest possible moment at which you may arrive at anchor point . The stable arrival time of anchor point is the minimum among the arrival times of all stable paths that reach . You may start at any non-negative time. If there is no stable path to visit anchor point , or if , then .
Please compute the maximum value of .
Input Format
The input consists of lines.
The first line contains three integers , representing the number of anchor points, the number of routes, and the starting anchor point.
The next lines each contain six integers , describing route . The meanings of the variables are given in the description.
Output Format
Output one line with one integer, representing the maximum value among .
4 10 1
4 2 6 20111 6 11900
2 4 2 10786 13 23576
2 1 3 5274 16 13903
2 1 2 17162 1 26120
1 2 1 42040 11 16065
2 1 4 23690 18 26541
2 3 9 18977 2 26795
4 1 4 51880 1 25060
1 4 13 17776 3 28236
1 4 1 19112 1 10131
26795
见选手目录下的 wind/wind2.in 与 wind/wind2.ans。
见选手目录下的 wind/wind3.in 与 wind/wind3.ans。
见选手目录下的 wind/wind4.in 与 wind/wind4.ans。
Hint
Sample Explanation 1
For anchor point , clearly .
For anchor point , along the path , .
For anchor point , along the path , .
For anchor point , along the path , .
Therefore, the answer is .
Subtasks
For all testdata, it is guaranteed that , , , , and .
| Test Point ID | Special Property | |||
|---|---|---|---|---|
| None | ||||
| A | ||||
| None | ||||
Special Property A: The number of routes connected to a single anchor point does not exceed .
Translated by ChatGPT 5