#P11021. Minimum Maximum Speed
Minimum Maximum Speed
Minimum Maximum Speed
A is driving on a straight road which can be abstracted as a number line. You are given n monitoring records. The i-th record indicates that A passed coordinate x_i at time t_i. You then have m independent queries. In the i-th query, you are given two integers ui and vi. In that query, the time recorded at the ui-th monitor is temporarily changed to vi (the modification is effective only for the current query), and you are to determine the smallest possible value of the maximum speed that A could have ever achieved on any valid driving trajectory, rounded down.
More formally, for each query after modifying tui</em> to vi, you need to compute:
Note: Time modifications in queries are independent; that is, after each query, the modified time is reverted back to the original value.
inputFormat
The first line contains two integers n and m (number of monitoring records and number of queries).
The second line contains n integers x1, x2, ..., xn representing the coordinates.
The third line contains n integers t1, t2, ..., tn representing the times A passed the corresponding coordinates.
The following m lines each contain two integers ui and vi, representing that in this query, the time at index ui is temporarily modified to vi.
outputFormat
For each query, output a single integer on a separate line, which is the answer as defined in the problem statement.
sample
3 1
0 10 20
1 4 6
2 5
10