It's just a second answer, and then consider how to validate.
Meet the Bi−ai≤mid b_i-a_i \le mid point on the tube, set the transmission point built in X,y X,y, the remaining points need to meet:
| x−ai|+| Y−bi|≤mid | x-a_i|+| Y-b_i|\le mid
This is difficult to do if we find that we consider enumerating an endpoint. Can be transformed, note that the constraint above is a form of a Manhattan distance, that is to say (X,y) (X,y), (Ai,aj) (A_i,a_j) as a point, and then just ask some congruent squares whether there is a turn on the line.
#include <cstdio> #include <cstring> #include <algorithm> #define FIR a #define SEC second #define MP
(x,y) Make_pair (x,y) using namespace std;
const int maxn=500005;
int N,m,mid,ans;
Pair<int,int> A[MAXN];
BOOL Check () {int t1=1e9,t2=-1e9,t3=1e9,t4=-1e9; for (int i=1;i<=m;i++) if (A[i]. Sec-a[i]. Fir>mid) {t1=min (T1,a[i]. Fir+a[i].
SEC+MID); T2=max (T2,a[i]. Fir+a[i].
SEC-MID); T3=min (T3,a[i]. Sec-a[i].
FIR+MID); T4=max (T3,a[i]. Sec-a[i].
FIR-MID);
Return t2<=t1&&t4<=t3;
int main () {freopen ("51nod1671.in", "R", stdin);
Freopen ("51nod1671.out", "w", stdout);
scanf ("%d%d", &n,&m); for (int i=1;i<=m;i++) {scanf ("%d%d", &a[i). Fir,&a[i].
SEC); if (a[i). Fir>a[i]. SEC) Swap (a[i). Fir,a[i].
SEC); if (a[i). Fir==a[i].
SEC) I--, m--;
} if (!m) return printf ("0"), 0;
int l=1,r=1000000;
while (l<=r) {mid= (l+r) >>1; if (check ()) R=mid-1, Ans=mid;
else l=mid+1;
printf ("%d\n", ans);
return 0; }