Orig Description
Score : 500 points
Problem StatementThere are N points on the 2D plane, i-th of which is located on (x_i, y_i).
There can be multiple points that share the same coordinate.
What is the maximum possible Manhattan distance between two distinct points?
Here, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.
Constraints
2 \leq N \leq 2 \times 10^5
1 \leq x_i,y_i \leq 10^9
All values in input are integers.
InputInput is given from Standard Input in the following format:
N
x_1 y_1
x_2 y_2
:
x_N y_N
OutputPrint the answer.
Sample Input 13
1 1
2 4
3 2
Sample Output 14
The Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.
Sample Input 22
1 1
1 1
Sample Output 20
Extracted Specification
An integer N (2 ≤ N ≤ 2 × 10^5), representing some quantity or size.
N pairs of integers (x_i, y_i) where each integer is between 1 and 10^9.
### Example Input:
```
3
1 1
2 4
3 2
```
### Function Signature:
Write a function f(N, points) that takes in the input.
```python
def f(N: int, points: List[Tuple[int, int]]):
'''
N: an integer
points: a list of tuples, each containing two integers
'''
```
Test Case Generator
Sure! Here's a Python function that generates test cases for the given problem statement about calculating the maximum possible Manhattan distance between two points on a 2D plane.
```python
import random
def tcgen():
# Number of points on the 2D plane
N = random.randint(2, 2 * 10**5)
# Generate the list of points
points = [(random.randint(1, 10**9), random.randint(1, 10**9)) for _ in range(N)]
return N, points
# Example usage
if __name__ == "__main__":
N, points = tcgen()
print(N)
for x, y in points:
print(x, y)
```
### Explanation:
1. **N**: This is generated randomly within the given constraints, i.e., between 2 and 200,000.
2. **Points**: Each point (x_i, y_i) is generated such that both x_i and y_i are random integers between 1 and \(10^9\).
### Example Output:
Upon running the `tcgen` function, you may get an output like:
```
4
123456789 987654321
135792468 246813579
102938475 564738291
192837465 564738291
```
This provides a valid input for the problem statement.
Feel free to adjust the random seed (using `random.seed()`) if you need reproducible test cases.
Extract Arguments
def extract_arguments(fh):
N = int(fh.readline().strip())
points = []
for _ in range(N):
x, y = map(int, fh.readline().strip().split())
points.append((x, y))
return N, points
# if __name__ == "__main__":
# input_path = sys.argv[1]
# with open(input_path, 'r') as fh:
# N, points = extract_arguments(fh)
# f(N, points)