/* -*- 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 = 0, maxc = 0; int j0 = 0, j1 = 0; for (int j = 1; 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 = n - 1; i > 0; i--) { ll c0 = cross(tis[i].second, tis[j0].second); while (j0 != i) { int jj = (j0 + n + 1) % n; ll cc = cross(tis[i].second, tis[jj].second); if (cc >= c0) break; c0 = cc, j0 = jj; } minc = min(minc, c0); } for (int i = 1; i < n; i++) { 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; }