题目
C. Electrification
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
At first, there was a legend related to the name of the problem, but now it’s just a formal statement.
You are given n points a1,a2,…,an on the OX axis. Now you are asked to find such an integer point x on OX axis that fk(x) is minimal possible.
The function fk(x) can be described in the following way:
form a list of distances d1,d2,…,dn where di=|ai−x| (distance between ai and x);
sort list d in non-descending order;
take dk+1 as a result.
If there are multiple optimal answers you can print any of them.
Input
The first line contains single integer T (1≤T≤2⋅105) — number of queries. Next 2⋅T lines contain descriptions of queries. All queries are independent.
The first line of each query contains two integers n, k (1≤n≤2⋅105, 0≤k<n) — the