CF485B.Valuable Resources

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems.

Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. The map contains mines with valuable resources, located at some points with integer coordinates. The sizes of mines are relatively small, i.e. they can be treated as points. The city should be built in such a way that all the mines are inside or on the border of the city square.

Building a city takes large amount of money depending on the size of the city, so you have to build the city with the minimum area. Given the positions of the mines find the minimum possible area of the city.

许多电脑策略游戏要求建造城市、招募军队、征服部落、收集资源。有时这会引出一些有趣的问题。

假设你的任务是建造一座正方形城市。世界地图采用笛卡尔坐标系,城市的四边应与坐标轴平行。地图上分布着若干蕴藏宝贵资源的矿场,其位置为一些整数坐标的点。矿场的尺寸相对较小,因此可将其视为点。城市必须建造得足够大,使得所有矿场均位于城市正方形的内部或边界上。

建造城市的成本取决于城市的面积大小,因此你需要建造面积最小的城市。给定所有矿场的位置,请找出满足条件的最小可能城市面积。

输入格式

The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers x__i and y__i — the coordinates of the corresponding mine ( - 109 ≤ x__i, y__i ≤ 109). All points are pairwise distinct.

输入的第一行包含一个整数 nn —— 地图上地雷的数量(2≤n≤10002 \leq n \leq 1000)。接下来的 nn 行中,每行包含一对整数 xix_i 和 yiy_i —— 对应地雷的坐标(−109≤xi,yi≤109-10^9 \leq x_i, y_i \leq 10^9)。所有点两两互不相同。

输出格式

Print the minimum area of the city that can cover all the mines with valuable resources.

输出能够覆盖所有富含资源矿藏的城市的最小面积。

输入输出样例

  • 输入#1

    2
    0 0
    2 2

    输出#1

    4
  • 输入#2

    2
    0 0
    0 3

    输出#2

    9

输入解题思路,AI测评打分。不知道怎么写?

首页