#P1175C. Electrification
Electrification
Description
At first, there was a legend related to the name of the problem, but now it's just a formal statement.
You are given points on the axis. Now you are asked to find such an integer point on axis that is minimal possible.
The function can be described in the following way:
- form a list of distances where (distance between and );
- sort list in non-descending order;
- take as a result.
If there are multiple optimal answers you can print any of them.
The first line contains single integer () — number of queries. Next lines contain descriptions of queries. All queries are independent.
The first line of each query contains two integers , (, ) — the number of points and constant .
The second line contains integers () — points in ascending order.
It's guaranteed that doesn't exceed .
Print integers — corresponding points which have minimal possible value of . If there are multiple answers you can print any of them.
Input
The first line contains single integer () — number of queries. Next lines contain descriptions of queries. All queries are independent.
The first line of each query contains two integers , (, ) — the number of points and constant .
The second line contains integers () — points in ascending order.
It's guaranteed that doesn't exceed .
Output
Print integers — corresponding points which have minimal possible value of . If there are multiple answers you can print any of them.
Related
In following contests: