c语言
#include <stdio.h>
int main()
{
int max(int x,int y);
int min(int x,int y);
int length, n, post, mintime, maxtime;
int i;
int x[1000];
int y[1000];
scanf("%d",&i);
int k;
k=i;
while(i--)
{
mintime = 0;
maxtime = 0;
scanf("%d %d", &length, &n);
while(n--)
{
scanf("%d",&post);
mintime = max(mintime,min((length-post),post));
x[i]=mintime;
maxtime = max(maxtime,max((length-post),post));
y[i]=maxtime;
}
}
while(k--)
{
printf("%d %d\n",x[k],y[k]);
}
return 0;
}
int max(int x,int y)
{
int z;
x>y?z=x:z=y;
return(z);
}
int min(int x,int y)
{
int z;
x>y?z=y:z=x;
return(z);
}