#K38987. Total Minimum Delivery Distance
Total Minimum Delivery Distance
Total Minimum Delivery Distance
You are given an integer n representing the number of deliveries, followed by n pairs of integers. Each pair represents the coordinates (x, y) of a delivery location.
For each delivery, a delivery person starts at the service station located at the origin (0, 0), travels to the destination, and returns back to the station. The distance for a single delivery is computed using the Manhattan distance: \[ d = 2(|x|+|y|), \] where \(|x|\) and \(|y|\) are the absolute values of the coordinates. Your task is to compute the total minimum distance required to complete all deliveries.
Input Format: The first line contains an integer n. The following n lines each contain two space-separated integers representing the coordinates.
Output Format: Print a single integer representing the total minimum distance.
inputFormat
The first line of input contains an integer n (the number of deliveries). Each of the next n lines contains two space-separated integers x and y which denote the coordinates of a delivery location.
Example:
3 1 2 3 4 -1 -2
outputFormat
Output a single integer: the total minimum distance required to complete all deliveries.
Example:
26## sample
1
1 2
6
</p>