转换思想 两只蚂蚁碰头反转时 相当于直接从对方身上走过去 直接前进
#include "stdio.h"
#include "string.h"
#include "math.h"
#include "stdlib.h"
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <queue>
using namespace std;
int t;
int main()
{
cin>>t;
while (t--)
{
int n,m,tt;
cin>>n>>tt;
int p;
int an1=-1000000,an2=-1000000;
for (int i=1;i<=tt;i++)
{
cin>>m;
an1=max( an1,min( (n-m) ,(n-(n-m)) ) );
an2=max( an2,max( (n-m) ,(n-(n-m)) ) );
}
cout<<an1<<" "<<an2<<endl;
}
return 0;
}