#P5098. Communication Time Between Cows
Communication Time Between Cows
Communication Time Between Cows
John's N cows (where \(1 \leq N \leq 50000\)) are exploring a dark cave. They can only communicate through their calls. The time taken for communication between any two cows is determined by the Manhattan distance between their positions. For two cows with coordinates \((x_1, y_1)\) and \((x_2, y_2)\), the communication time is given by:
[ |x_1 - x_2| + |y_1 - y_2| ]
Your task is to find the maximum communication time among any pair of cows.
Constraints:
- \(1 \leq N \leq 50000\)
- \(-10^6 \leq x_i, y_i \leq 10^6\)
inputFormat
The first line contains an integer \(N\), the number of cows. Each of the next \(N\) lines contains two integers representing the coordinates \(x\) and \(y\) of a cow.
outputFormat
Output a single integer—the maximum Manhattan distance between any two cows.
sample
2
-1 0
1 0
2