|
|||
Robot DistanceIn a large warehouse, a robot can move between specified locations. The locations are given by their coordinates. The robot can only move parallel with the axes of the coordinate system. This means that when the robot wants to move from location p = (x1, y1) to location q = (x2, y2), it must go first to the place (x2, y1) and then to q = (x2, y2). Therefore, the distance that the robot travels is |x2 − x1| + |y2 − y1|. This value is called the robot distance of the locations p and q. You are to write a program that, given a set of locations, computes the largest robot distance between two locations in the set. Input SpecificationThe input contains several blocks of test cases. The first line of each case contains a single integer n (2 ≤ n ≤ 100 000), the number of locations. Each of the next n lines contains two integers x and y, the coordinates of a location (−100 000 000 ≤ x, y ≤ 100 000 000). The input is terminated by a block with n = 0. Output SpecificationFor each test case in the input, you have to output a single integer on a separate line: the largest robot distance between the locations given in the input. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |