|
|||
Protect the CitiesThere are N cities in Imaginary Land. The President of Imaginary Land uses the Cartesian coordinates. Each city is located at some point with integer coordinates. The President is very careful and concerned about the well-being of the citizens of his country. For that reason, he wants to create a boundary and cover all the cities inside that boundary. The boundary should have the shape of a square and be parallel to the coordinate axes. Find the minimum area enclosed by the boundary such that all the cities are on or inside the boundary. Input SpecificationThe first line of the input contains T, denoting the number of test cases (1 ≤ T ≤ 5). Each test case begins with a single positive integer N, denoting the number of cities in Imaginary Land (1 ≤ N ≤ 105). Each of the next N lines contains two integers xi and yi, denoting the coordinates of the ith city (–109 ≤ xi, yi ≤ 109). Output SpecificationFor each test case, output a single nonnegative integer, denoting the minimum area of the square boundary that encloses all the cities inside or on its boundary. Sample Input
Output for Sample Input
Sample ExplanationIn the first test case, all the points are on the boundary of a square of side 2. Hence the answer is 4. In the second test case, the smallest square that can be drawn is of side 2, having its center at (1, 1). |
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |