F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Point

Time Limit: 40000/20000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1058    Accepted Submission(s): 303


Problem Description
There are a lot of points on a plane. We need to find the closest point for each point. To be special, Ħ°closestĦħ refers to unusual distance: the distance of two points A, B is defined by this:
Distance (A, B) = max (|Ax ¨C Bx|, |Ay ¨C By|)
Please output the sum of the distances.
 

Input
The input consists of multiply test cases. The first line of each test case contain one integer, n (2 <= n <= 100000), which is the number of points. Each of the next n lines contains two integer, x, y (0 <= x, y <= 1000000000), indicating the coordinate of a point. Two points might have the same coordinate.
 

Output
Output the sum of the distances.
 

Sample Input
3 0 0 1 1 3 3
 

Sample Output
4
 

Author
momodi
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-12 04:22:17, Gzip enabled