<span style="font-family: Arial, Helvetica, sans-serif;">最短时间即为最靠近中间的一点到最近的一边的时间
最长时间即为最靠近一边的点到另一边的距离,碰撞起的实际上是传递作用</span>
<span style="font-family: Arial, Helvetica, sans-serif;">#include<stdio.h></span>
#include<math.h>
int main(){
int n,len,num,ant,lf,rt,max;
double mid,md;
scanf("%d",&n);
while(n--){
scanf("%d%d",&len,&num);
mid = len*1.0/2;
md = len;
lf = len;
rt = 0;
while(num--){
scanf("%d",&ant);
if(fabs(ant - mid)<md) md = fabs(ant - mid);
if(ant < lf) lf = ant;
if(ant > rt) rt = ant;
}
if(lf<(len - rt)) max = len - lf;
else max = rt;
printf("%d %d\n",(int)(mid - md),max);
}
return 0;
}