307805: CF1419F. Rain of Fire
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Rain of Fire
题意翻译
- 平面中有 $ n $ 个点,你可以在任意一个位置加入一个点,使这个点经过一些点后可以到达所有点. - 从一个点出发只能向上下左右四个方向移动最多 $ T $ 个单位长度 ,并且在到达另一个点之前不能转向. - 求最小的 $ T $ ,若不存在可行的 $ T $ ,则输出 $ -1 $ .题目描述
There are $ n $ detachments on the surface, numbered from $ 1 $ to $ n $ , the $ i $ -th detachment is placed in a point with coordinates $ (x_i, y_i) $ . All detachments are placed in different points. Brimstone should visit each detachment at least once. You can choose the detachment where Brimstone starts. To move from one detachment to another he should first choose one of four directions of movement (up, right, left or down) and then start moving with the constant speed of one unit interval in a second until he comes to a detachment. After he reaches an arbitrary detachment, he can repeat the same process. Each $ t $ seconds an orbital strike covers the whole surface, so at that moment Brimstone should be in a point where some detachment is located. He can stay with any detachment as long as needed. Brimstone is a good commander, that's why he can create at most one detachment and place it in any empty point with integer coordinates he wants before his trip. Keep in mind that Brimstone will need to visit this detachment, too. Help Brimstone and find such minimal $ t $ that it is possible to check each detachment. If there is no such $ t $ report about it.输入输出格式
输入格式
The first line contains a single integer $ n $ $ (2 \le n \le 1000) $ — the number of detachments. In each of the next $ n $ lines there is a pair of integers $ x_i $ , $ y_i $ $ (|x_i|, |y_i| \le 10^9) $ — the coordinates of $ i $ -th detachment. It is guaranteed that all points are different.
输出格式
Output such minimal integer $ t $ that it is possible to check all the detachments adding at most one new detachment. If there is no such $ t $ , print $ -1 $ .
输入输出样例
输入样例 #1
4
100 0
0 100
-100 0
0 -100
输出样例 #1
100
输入样例 #2
7
0 2
1 0
-3 0
0 -2
-1 -1
-1 -3
-2 -3
输出样例 #2
-1
输入样例 #3
5
0 0
0 -1
3 0
-2 0
-2 1
输出样例 #3
2
输入样例 #4
5
0 0
2 0
0 -1
-2 0
-2 1
输出样例 #4
2