[CF2290G1] 环湖步道(简单版)(Lakeside Trail - Easy)
Problem Statement
(This is the Easy Version of the problem; the constraints on and are smaller.)
A circular lakeside trail consists of segments numbered through in clockwise order, where segment initially has height . Segment is also adjacent to segment .
The steepness of the trail is defined as the maximum absolute height difference between any two adjacent segments, i.e., (with ).
You have units of dirt. Spending unit of dirt increases the height of a chosen segment by (you may spend multiple units on the same segment, and heights can only be increased, never decreased).
Find the minimum possible steepness of the trail after spending at most units of dirt.
Input
The first line contains () — the number of test cases.
The first line of each test case contains and (, ). The second line contains integers ().
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, print a single integer — the minimum possible steepness.
Example
6
4 3
1 5 2 8
5 5
2 9 4 1 6
3 0
1 4 7
3 100
1 10 1
5 5
4 1 1 1 1
6 14
3 6 2 4 1 5
5
4
6
0
2
1
Note
- Constraints: , , , , .
- Source: Codeforces 2290G1 · Lakeside Trail (Easy Version)