/* Judge Status : Accepted Language : C++ Submit Time:2018-09-22 09:20:29 Exe.Time:641MS Exe.Memory:572K */ #include<iostream> #include<algorithm> usingnamespace std;
constint MAXN = 1E6; int arr[MAXN];
intmain() { ios::sync_with_stdio(false); int test; cin >> test; while(test--) { int l, n; cin >> l >> n; for(int i = 0; i < n; i++) cin >> arr[i]; int minT = 0; for(int i = 0; i < n; i++) { minT = max(minT, min(arr[i], l - arr[i])); //求的是所有蚂蚁都下落的时间,所以求的是最大值,保证所有蚂蚁都下落了 }
int maxT = 0; for(int i = 0; i < n; i++) { maxT = max(maxT, max(arr[i], l - arr[i])); } cout << minT << " " << maxT << endl; } return0; }