蒟蒻稀烂模拟,佬佬勿喷
#include<iostream>
#include<algorithm>
using namespace std;
int v[1000010];
int main()
{
int T,n,k,x;
int res = 0;
cin >> T;
while(T -- ){
cin >> n >> k;
int z = 0;
for (int i = 0; i < k; i ++ ) {
cin >> x;
v[z++] = x;
}
int ee = n - v[z - 1] + 1;
int bb = v[0];
int yy,y = -1;
sort(v,v+z);
for(int i = 0; i < z - 1; i++){
int kk = v[i + 1] - v[i];
if(kk%2){
kk/=2;
yy = kk + 1;
}
else {
kk = (kk + 1)/2;
yy = kk + 1;
}
if(yy > y) y = yy;
}
if(bb < ee) bb = ee;
if(y < bb) y = bb;
cout << y << endl;
}
return 0;
}
|