#P3964. [TJOI2013] 松鼠聚会
[TJOI2013] 松鼠聚会
Description
A group of little squirrels lives on the prairie, and each squirrel has a home. After a long time, they feel they should have a gathering. However, the prairie is very large, and they are troubled about whose home would be the most reasonable place to meet.
Each squirrel’s home is represented by a point . The distance between two points is defined so that the distance between point and each of its eight neighbors , , , , , , , is .
Input Format
The first line contains an integer , the number of squirrels. The next lines, the -th line contains two integers and , the coordinates of squirrel ’s home.
Output Format
Output a single integer, the minimum possible sum of distances the squirrels need to travel to gather.
6
-4 -1
-1 -2
2 -4
0 2
0 3
5 -2
20
6
0 0
2 0
-5 -2
2 -2
-1 2
4 0
15
Hint
Sample Explanation
In the first sample, the squirrels gather at the second squirrel’s home ; in the second sample, they gather at the first squirrel’s home .
Constraints
- For of the testdata, .
- For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号