简单水题,练手
#include <stdio.h>
#define MIN(a,b) (a<b ? a:b)
#define MAX(a,b) (a>b ? a:b)
int ant[1000005];
void solve(int L, int n){
int i, tmp;
int max_early, max_late;
max_early = max_late = -1;
for(i=1; i<=n; i++){
tmp = MIN(ant[i], L-ant[i]);
max_early = MAX(max_early, tmp);
tmp = MAX(ant[i], L-ant[i]);
max_late = MAX(max_late, tmp);
}
printf("%d %d\n", max_early, max_late);
}
int main(void){
int L, n, case_n, i;
//freopen("input.dat", "r", stdin);
scanf("%d", &case_n);
while(case_n--){
scanf("%d %d", &L, &n);
for(i=1; i<=n; i++)
scanf("%d", ant+i);
solve(L, n);
}
return 0;
}