#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <string>
#include <cstring>
#include <algorithm>
#include <iostream>
#define maxn 100010
#define INF 0x7fffffff
#define inf 100000000
#define MOD 1000000007
#define ULL unsigned long long
#define LL long long
using
namespace std;
const
double ESP = 1e-10;
double
add( double
a, double
b) {
if ( abs (a+b) < ESP * ( abs (a) + abs (b))) return
0;
return
a+b;
}
struct
P
{
double
x, y;
P() {}
P( double
x, double
y) : x(x), y(y) {}
P operator - (P p) {
return
P(add(x, -p.x), add(y, -p.y));
}
P operator + (P p) {
return
P(add(x, p.x), add(y, p.y));
}
P operator * ( double
d) {
return
P(x*d, y*d);
}
double
dot(P p) {
return
add(x*p.x, y*p.y);
}
double
det(P p) {
return
add(x*p.y, - y*p.x);
}
};
P ps[maxn];
int
n;
bool
cmp_x( const
P& p, const
P& q) {
if (p.x != q.x) return
p.x < q.x;
return
p.y < q.y;
}
vector<P> convex_full() {
sort(ps, ps+n, cmp_x);
int
k = 0;
vector<P> qs(n*2);
for ( int
i = 0; i < n; ++ i) {
while (k > 1 && (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0)
-- k;
qs[k++] = ps[i];
}
for ( int
i = n-2, t = k; i >= 0; -- i) {
while (k > t && (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0)
-- k;
qs[k++] = ps[i];
}
qs.resize(k-1);
return
qs;
}
double
dist(P p, P q) {
return
(p-q).dot(p-q);
}
void
solve() {
vector<P> qs = convex_full();
// printf("%d\n", qs.size());
double
res = 0;
for ( int
i = 0; i < ( int )qs.size(); ++ i) {
for ( int
j = 0; j < i; ++ j) {
res = max(res, dist(qs[i], qs[j]));
}
}
printf ( "%.0lf\n" , res);
}
int
main()
{
while ( scanf ( "%d" , &n) == 1) {
for ( int
i = 0; i < n; ++ i) {
scanf ( "%lf%lf" , &ps[i].x, &ps[i].y);
}
solve();
}
return
0;
}
|