The main topic: some points on the plane, to find a point to all points of Chebyshev distance and minimum.
Idea: And the squirrel's title is more like, but the squirrel is the point of seeking is a point in all points, and this question is not necessarily. As with that problem, the horizontal ordinate is sorted separately, and then the median count is taken. However, it is possible to have decimals, so adjust it and take the minimum value.
CODE:
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define MAX 100010using namespace std; #define MIN (a) < (b) (a):(b)) int X[max],y[max]; struct point{int x, y; void Read (int p) {scanf ("%d%d", &x,&y); X[P] = x + y; Y[P] = x-y; }}point[max]; int points; Inline long long getans (int x,int y) {long long re = 0; for (int i = 1; I <= points; ++i) re + + ABS (X-x[i]) + ABS (Y-y[i]); return re;} int main () {CIN >> points; for (int i = 1; I <= points; ++i) Point[i]. Read (i); Sort (X + 1,x + points + 1); Sort (Y + 1,y + points + 1); int x = x[(points + 1) >> 1],y = y[(points + 1) >> 1]; if ((x&1 && y&1) | | (! (x&1) &&! (y&1))) cout << Getans (x, y)/2 << Endl; else cout << min (min (Getans (x + 1,y), Getans (y + 1), Min (Getans (x-1,y), Getans (x,y-1)))/2 << Endl ; return 0;}
Bzoj 3210 Flower God's watering flower rally Chebyshev distance