#P11021. 「LAOI-6」区间测速
「LAOI-6」区间测速
Description
Little A is driving on a straight highway (can make U-turns instantly, ignoring time and distance), abstracted as a number line.
You are given information from surveillance records. The -th record indicates Little A was at coordinate at time .
There are queries. The -th query provides and : if the time of the -th record is temporarily changed to , what is the minimal possible value of the maximum speed (floor to integer) in any valid driving path? Queries are independent; modifications are reverted after each query.
Formal Description
Given , , arrays , and of length . For each of independent modifications (changing to ), compute:
$$\left\lfloor \max_{1 \le i < j \le n} \frac{|x_i - x_j|}{|t_i - t_j|} \right\rfloor$$Input Format
First line: Two integers , .
Next lines: Two integers , .
Next lines: Two integers , .
Output Format
For each query, output the floor of the maximum speed.
5 3
10 3
-10 1
0 5
-5 0
10 7
1 2
2 2
3 100
20
20
10
Hint
Sample Explanation
After the first query:
- Little A's positions: , , , , .
- The minimal maximum speed is (from to , moving to ).
Constraints:
- , .
- , .
- .
- All (after modifications) are distinct.
Test Cases
| Test Case | Special Properties |
|---|---|
| 1~3 | |
| 4~5 | |
| 6~7 | |
| 8~10 | None |
京公网安备 11011102002149号