#include using namespace std; using ll = long long; #define dbl long double #define vec vector #define um unordered_map #define us unordered_set using ull = unsigned long long; using vi = vec; using vl = vector; using vd = vector; using pii = pair; using pll = pair; using pdd = pair; struct P { pii point; int index; static bool cmp_x(const P &first, const P &other) { return first.point < other.point; } static bool cmp_y(const P &first, const P &other) { return tie(first.point.second, first.point.first) < tie(other.point.second, other.point.first); } double dist(const P &other) const { double dx = this->point.first - other.point.first; double dy = this->point.second - other.point.second; return sqrt(dx * dx + dy * dy); } friend ostream &operator<<(ostream &os, const P &p) { return os << "[" << p.point.first << ", " << p.point.second << "] "; } }; int main() { cin.sync_with_stdio(false); cin.tie(0); cin.exceptions(ios::failbit); int n; cin >> n; vector

by_x1; vector

by_y1; vec points; vector visited(n, false); for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; points.emplace_back(x, y); by_x1.push_back(P{pii{x, y}, i}); by_y1.push_back(P{pii{x, y}, i}); } sort(by_x1.begin(), by_x1.end(), P::cmp_x); sort(by_y1.begin(), by_y1.end(), P::cmp_y); deque

by_x(by_x1.begin(), by_x1.end()); deque

by_y(by_y1.begin(), by_y1.end()); P x_min, x_max, y_min, y_max; P a, b, c, d; while (!by_x.empty() && !by_y.empty()) { do { if (by_x.empty()) { break; } x_min = by_x.front(); by_x.pop_front(); } while (visited[x_min.index]); do { if (by_x.empty()) { break; } x_max = by_x.back(); by_x.pop_back(); } while (visited[x_max.index]); visited[x_min.index] = visited[x_max.index] = true; if (x_min.point.second == x_max.point.second) { do { if (by_x.empty()) { break; } y_min = by_x.front(); by_x.pop_front(); } while (visited[y_min.index]); do { if (by_x.empty()) { break; } y_max = by_x.back(); by_x.pop_back(); } while (visited[y_max.index]); } else { do { if (by_y.empty()) { break; } y_min = by_y.front(); by_y.pop_front(); } while (visited[y_min.index]); do { if (by_y.empty()) { break; } y_max = by_y.back(); by_y.pop_back(); } while (visited[y_max.index]); }; visited[y_min.index] = visited[y_max.index] = true; a = x_min, b = x_max, c = y_min, d = y_max; } double d1 = a.dist(b); double d2 = a.dist(c); double d3 = a.dist(d); //cout << a << b << c << d << endl; //printf("%.10lf\n", (d1 * d2 * d3 / max(d1, max(d2, d3)))); cout << int(round((d1 * d2 * d3 / max(d1, max(d2, d3))))) << endl; }