#P1329E. Dreamoon Loves AA
Dreamoon Loves AA
Description
There is a string of length of characters 'A' and 'B'. The first character and last character of the string are equal to 'A'.
You are given indices (-indexation) denoting the other indices of characters 'A' in the string.
Let's denote the minimum distance between two neighboring 'A' as , and maximum distance between neighboring 'A' as .
For example, of string "ABBAABBBA" is .
And let's denote the balance degree of a string as the value of .
Now Dreamoon wants to change exactly characters from 'B' to 'A', and he wants to make the balance degree of the string as small as possible.
Please calculate the required minimum possible value of balance degree.
The first line contains one integer denoting the number of test cases ().
For each test case, the first line contains three integers , and ().
The second line contains integers , ().
The total sum of is at most .
For each test case, print one integer: the smallest possible value of balance degree after changes of 'B' to 'A'.
Input
The first line contains one integer denoting the number of test cases ().
For each test case, the first line contains three integers , and ().
The second line contains integers , ().
The total sum of is at most .
Output
For each test case, print one integer: the smallest possible value of balance degree after changes of 'B' to 'A'.