We need to solve the problem: given n points with integer coordinates, find the minimum area of an axis-aligned square that covers all points (points can be on border). The square sides are parallel to axes. Minimum area square that encloses all points. Since it's axis-aligned, we essentially need to find a square that covers all points. The square can be of any side length (not necessarily integer) but area must be computed. Since points are integer but square can be placed at any real coordinates? Usually in such problems, the square must have sides parallel to axes, and the square's corners could be at any real coordinates. However, since all points are integer, the optimal square can be defined by min and max x and y. But the square's side length must be equal in both dimensions. So we have to consider the bounding box: let x_min = min x, x_max = max x, y_min = min y, y_max = max y. The width along x is W = x_max - x_min, along y is H = y_max - y_min. To cover all points with a square, we need side length L >= max(W, H). But we might be able to shift the square (i.e., not necessarily aligned with min x and min y) to possibly reduce required L? Actually, if we allow arbitrary placement, the minimal side length L is the smallest value such that there exists a square of side L (axis-aligned) containing all points. That is equivalent to: there exists some interval of length L on x-axis covering all x-coordinates of points, and some interval of length L on y-axis covering all y-coordinates of points. Because the square is axis-aligned, the x-range of the square is [a, a+L] and y-range is [b, b+L] for some a,b. The condition is: all x_i ∈ [a, a+L] and all y_i ∈ [b, b+L]. So we need to choose a and b such that max(x_i) - min(x_i) ≤ L? Not exactly: we can shift the interval. For given L, we can cover points if the width of the points (x_max - x_min) ≤ L and similarly height ≤ L, but also we have flexibility: if width is less than L, we can adjust the interval to cover them. So the condition for existence of a covering interval of length L is: x_max - x_min ≤ L and y_max - y_min ≤ L. However, is that sufficient? Yes, because we can set a = x_min, and a+L >= x_max (since L >= x_max-x_min). So that works. So the minimal L is max( x_max - x_min, y_max - y_min). But then the area would be L^2. But is that always minimal? Let's test examples: Example 1: points (0,0) and (2,2). x_min=0, x_max=2 => width=2; y_min=0, y_max=2 => height=2; L=2; area=4. Matches. Example 2: points (0,0) and (0,3). x_min=0, x_max=0 => width=0; y_min=0, y_max=3 => height=3; L=3; area=9. Matches. So it seems trivial. But wait, are there cases where we can get a smaller L by rotating? No rotation allowed. So it's just bounding box's maximum dimension. So answer = (max(x_range, y_range))^2. But I recall sometimes the problem requires that the square's sides are parallel to axes, but the square's area might need to be integer? The output examples are integers. But there is a nuance: The square must have its sides parallel to axes, but the coordinates of mines are integer, but the square's corners can be at real numbers. So L can be any real number. So minimal L = max(x_range, y_range). So area = L^2. However, is it always optimal to align the square such that one side is at x_min or y_min? Could there be a case where the required L is less than max(range) because we can shift both axes to trade-off? For example, suppose points are (0,0) and (10,1). Then x_range=10, y_range=1, max=10. L=10 gives area=100. Could we do with L=9? If L=9, we need an interval of length 9 covering x from 0 to 10. That's impossible because any interval of length 9 cannot cover both 0 and 10 (max distance 10 > 9). So L must be at least 10. So indeed L must be at least the width. Similarly for y. So L must be at least max(width, height). So minimal L is exactly max(width, height). So answer is square of that.
But the problem statement might have additional hidden constraints: "The city should be built in such a way that all the mines are inside or on the border of the city square." That's it. So indeed this is trivial.
But why is this problem given as "Many computer strategy games... leads to interesting problems."? Possibly there is more: maybe the square must be placed such that its vertices have integer coordinates? Let's check problem source: Maybe it's from Codeforces or something. I recall a problem "Minimum area square covering points" but there the square could be rotated. Here it's axis-aligned, so trivial. However, note constraints: n up to 1000, coordinates up to 1e9. So indeed it's simple.
But wait, maybe there is a twist: The square must be axis-aligned, but also the sides are parallel to axes, and the mines are points. Could the square be placed such that the mines are inside, but maybe the square's side length must be integer? Not said. Usually such problems output integer area? Actually area is square of side length. But side length could be non-integer, then area could be non-integer. But the output format expects a number; it could be a real number? The examples output integer numbers. Possibly the answer will always be integer because min and max coordinates are integers, so difference is integer, so L integer, area integer. But what if width=3 and height=2? Then L=3, area=9 integer. So L is integer because it's the max of two integer differences, which is integer. So answer integer. So that's fine.
But what about floating point? Not needed.
Thus solution: read n, points, compute min_x, max_x, min_y, max_y, compute d = max(max_x - min_x, max_y - min_y), print d*d.
Edge cases: n=1? But constraints say n>=2. So fine.
Check example: 2 points only works.
Thus answer is trivial.
But wait, could the minimal square not align with min/max but shift to reduce L when we consider both dimensions simultaneously? Actually, to cover all points, we need a and b such that all x_i in [a, a+L] and all y_i in [b, b+L]. The necessary condition is that L >= max( x_max - x_min, y_max - y_min). It's also sufficient as shown. So indeed minimal L = max(width, height). There's no interplay because the two intervals are independent: we can choose a independently from b. So the minimal L is the maximum of the required spans. There's no possibility to reduce L by offsetting: For x, any covering interval length L must have its leftmost coordinate at least x_min? Actually, we can slide the interval: the interval must cover both x_min and x_max. So its left endpoint a must satisfy a <= x_min and a+L >= x_max. So a can be anywhere in [x_max - L, x_min]. This is possible only if x_max - L <= x_min, i.e., L >= x_max - x_min. So if L < width, no a exists; if L >= width, we can pick a = x_min (or x_max - L). So width constraint is necessary and sufficient. Similarly for y. So minimal L is max(width, height). So answer straightforward.
Thus code: read, compute.
Double-check: All points are distinct. Coordinates up to 1e9, differences up to 2e9, L up to 2e9, area up to 4e18 fits in 64-bit signed integer (2^63-1 = 9.22e18). So use long long.
Implementation in C++:
#include
#include
using namespace std;
int main() {
int n;
cin >> n;
long long x, y;
long long minX = 1e18, maxX = -1e18, minY = 1e18, maxY = -1e18;
for (int i=0; i<n; i++) {
cin >> x >> y;
if (x < minX) minX = x;
if (x > maxX) maxX = x;
if (y < minY) minY = y;
if (y > maxY) maxY = y;
}
long long d = max(maxX - minX, maxY - minY);
cout << d*d << endl;
return 0;
}
Edge case: if n=0? Not happen.
Thus solution done.
But I'm suspicious: perhaps the problem originally required the square's sides not necessarily aligned with axes? But it says "The sides of the city should be parallel to coordinate axes." So clear.
Thus answer trivial.
I will produce final answer.
```cpp
#include
#include
using namespace std;
int main() {
int n;
cin >> n;
// Initialize with extremes (coordinates are up to 1e9)
long long minX = (long long)1e18, maxX = (long long)-1e18;
long long minY = (long long)1e18, maxY = (long long)-1e18;
for (int i = 0; i < n; ++i) {
long long x, y;
cin >> x >> y;
minX = min(minX, x);
maxX = max(maxX, x);
minY = min(minY, y);
maxY = max(maxY, y);
}
long long side = max(maxX - minX, maxY - minY);
cout << side * side << endl;
return 0;
}