#P9519. pay
pay
Problem Description
Today is payday at Company L.
There are employees standing in a line to receive their salaries, numbered from to . The -th employee has an expected happiness value .
The boss is very stingy, and among these employees, he only chooses employees to pay a salary of yuan.
The employees are very empathetic: not only does their happiness increase when they themselves get paid, but it also increases when nearby employees get paid.
Specifically, when an employee at distance from employee A gets paid, A's happiness increases by . In particular, if A himself gets paid, A's happiness increases by .
The boss hopes that you can find the smallest integer such that every employee's happiness is not less than their expectation.
Input Format
The first line contains two integers .
The second line contains integers .
The third line contains integers .
Output Format
One integer, representing the smallest you found.
5 5
3 3 3 3 3
1 2 3 4 5
2
5 2
5 2 6 3 1
2 5
5
Hint
Sample Explanation
In sample , when , everyone's happiness values are , which meets the requirements.
In sample , when , everyone's happiness values are , which meets the requirements.
Constraints
For of the testdata, .
For of the testdata, .
For of the testdata, .
For another of the testdata, .
For of the testdata, , , , and all are distinct.
The input size of this problem is large, so please use a proper input method.
Translated by ChatGPT 5