#BS0000397. Hình vuông bao nhỏ nhất (Minimize Bounding Square)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Hình vuông bao nhỏ nhất (Minimize Bounding Square)
Minimize Bounding Square
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
There are points, point at . One operation moves a chosen point one unit in one of four axis-parallel directions. Perform at most operations, possibly none. Points may coincide, including initially. Enclose all resulting points in or on an axis-aligned square. Find its minimum achievable side length, allowing zero if all points can coincide.
Input
The first line contains integers . The next lines each contain the initial integer coordinates of point , in order.
Output
Print the minimum side length as an integer.
Subtasks
- Subtask 1 (20 points): ; ; for every .
- Subtask 2 (30 points): ; ; for every .
- Subtask 3 (50 points): ; ; for every .
Examples
Input
2 4
0 0
5 3
Output
2
Explanation
Move left three units and down one to . Both points lie in . Side length 1 requires reducing the coordinate separations by at least 4 and 2, totaling 6 moves, exceeding 4.
