1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#include <iostream> #include <cstdio> #include <cstring> #include <string> //#define INF 10000000 using namespace std; int main() { int t,diff,mn,mx; int len,num,a,c,d; int early,late; scanf("%d",&t); while(t--) { scanf("%d%d",&len,&num); mn=0; mx=0; for(int i=0;i<num;i++) { scanf("%d",&a); diff= len-a; c = max(diff,a); d = min(diff,a); mx = max(mx,c); mn = max(mn,d); //early=max(d,mn); } printf("%d %d\n",mn,mx); } return 0; } |