#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<ctype.h>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<bitset>
#include<algorithm>
#include<time.h>
using namespace std;
void fre(){freopen("c://test//input.in","r",stdin);freopen("c://test//output.out","w",stdout);}
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x,y) memcpy(x,y,sizeof(x))
#define MP(x,y) make_pair(x,y)
#define ls o<<1
#define rs o<<1|1
typedef long long LL;
typedef unsigned long long UL;
typedef unsigned int UI;
template <class T1,class T2>inline void gmax(T1 &a,T2 b){if(b>a)a=b;}
template <class T1,class T2>inline void gmin(T1 &a,T2 b){if(b<a)a=b;}
const int N=0,M=0,Z=1e9+7,ms63=1061109567;
int main()
{
int n;
while(~scanf("%d",&n))
{
LL minx=1e9;
LL miny=1e9;
LL maxx=-1e9;
LL maxy=-1e9;
for(int i=1;i<=n;++i)
{
int x,y;
scanf("%d%d",&x,&y);
gmin(minx,x);
gmin(miny,y);
gmax(maxx,x);
gmax(maxy,y);
}
LL len=max(maxx-minx,maxy-miny);
printf("%lld\n",len*len);
}
return 0;
}
/*
【trick&&吐槽】
这种题要堤防面积不能为0哦。
虽然这道题的面积可以是为0的。
【题意】
给你n(2<=n<=1000)个点,每个点的坐标都在[-1e9,1e9]之间。
问你一个最小面积的正方形的面积,使得该正方形包含所有点。
【类型】
水题
【分析】
直接更新坐标的最小值和最大值,然后调整成最小正方形求面积即可。
*/
【Codeforces Round 276 (Div 2)B】【水题】Valuable Resources 最小正方形包含所有点
最新推荐文章于 2018-10-31 16:25:00 发布