/* -*- coding: utf-8 -*- * * 2012.cc: No.2012 Largest Triangle - yukicoder */ #include #include #include #include using namespace std; /* constant */ const int MAX_N = 200000; const long long LINF = 1LL << 60; /* typedef */ using ll = long long; using pdi = pair; /* global variables */ ll xs[MAX_N], ys[MAX_N]; pdi tis[MAX_N]; /* subroutines */ inline ll cross(int i, int j) { return xs[i] * ys[j] - xs[j] * ys[i]; } /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%lld%lld", xs + i, ys + i); for (int i = 0; i < n; i++) tis[i] = {atan2(ys[i], xs[i]), i}; sort(tis, tis + n); ll minc = LINF, maxc = -LINF; int j0 = -1, j1 = -1; for (int j = 0; j < n; j++) { ll c = cross(tis[0].second, tis[j].second); //printf(" c=%lld,j=%d\n", c, j); if (minc > c) minc = c, j0 = j; if (maxc < c) maxc = c, j1 = j; } //printf("minc=%lld,j0=%d maxc=%lld,j1=%d\n", minc, j0, maxc, j1); for (int i = 1; i < n; i++) { ll c0 = cross(tis[i].second, tis[j0].second); while (j0 != i) { int jj = (j0 + 1) % n; ll cc = cross(tis[i].second, tis[jj].second); if (cc >= c0) break; c0 = cc, j0 = jj; } minc = min(minc, c0); ll c1 = cross(tis[i].second, tis[j1].second); while (j1 != i) { int jj = (j1 + 1) % n; ll cc = cross(tis[i].second, tis[jj].second); if (cc <= c1) break; c1 = cc, j1 = jj; } maxc = max(maxc, c1); } ll maxs = max(-minc, maxc); printf("%lld\n", maxs); return 0; }