Maximum Distance
InterviewTime limit1sMemory limit128 MB
Given up to 50,000 points, compute the maximum L1 (Manhattan) distance between any two of them.
Problem
Given N points (1 <= N <= 50,000), find the maximum L1-metric distance between two of the given points.
For two points with coordinates (a, b) and (c, d), their L1-metric distance is |a-c| + |b-d|.
Input
The first line contains the number of points N.
Each of the next N lines contains the x-coordinate and y-coordinate of one point. Every coordinate is between -1,000,000 and 1,000,000, inclusive.
Output
Print the maximum L1-metric distance between the given points.