#include #include #include #include #include #include #include #include using namespace std; using u64 = unsigned long long; struct pos { int x; int y; bool removed = false; bool topLeft(const pos& other) const { if (x < other.x) { return true; } else if (x == other.x && y < other.y) { return true; } else { return false; } } bool topRight(const pos& other) const { if (y < other.y) { return true; } else if (y == other.y && x > other.x) { return true; } else { return false; } } bool bottomLeft(const pos& other) const { if (x > other.x) { return true; } else if (x == other.x && y > other.y) { return true; } else { return false; } } bool bottomRight(const pos& other) const { if (y > other.y) { return true; } else if (y == other.y && x < other.x) { return true; } else { return false; } } friend bool operator==(const pos &lhs, const pos &rhs) { return lhs.x == rhs.x && lhs.y == rhs.y; } friend bool operator!=(const pos &lhs, const pos &rhs) { return !(lhs == rhs); } pos operator-(const pos& other) const { return pos{x - other.x, y - other.y}; } double length() const { return hypot(x, y); } }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int nodes; cin >> nodes; vector positions; vector topLeftVec; vector topRightVec; vector bottomLeftVec; vector bottomRightVec; positions.reserve(nodes); topLeftVec.reserve(nodes); topRightVec.reserve(nodes); bottomLeftVec.reserve(nodes); bottomRightVec.reserve(nodes); for (int i = 0; i < nodes; ++i) { pos p; cin >> p.x >> p.y; positions.push_back(p); topLeftVec.push_back(&positions[i]); topRightVec.push_back(&positions[i]); bottomLeftVec.push_back(&positions[i]); bottomRightVec.push_back(&positions[i]); } sort(topLeftVec.begin(), topLeftVec.end(), [](const pos* first, const pos* second) { return first->topLeft(*second); }); sort(topRightVec.begin(), topRightVec.end(), [](const pos* first, const pos* second) { return first->topRight(*second); }); sort(bottomLeftVec.begin(), bottomLeftVec.end(), [](const pos* first, const pos* second) { return first->bottomLeft(*second); }); sort(bottomRightVec.begin(), bottomRightVec.end(), [](const pos* first, const pos* second) { return first->bottomRight(*second); }); size_t topLeftIndex = 0, topRightIndex = 0, bottomLeftIndex = 0, bottomRightIndex = 0; int iter = nodes / 4; for (int i = 0; i < iter - 1; ++i) { topLeftVec[topLeftIndex]->removed = true; topRightVec[topRightIndex]->removed = true; bottomLeftVec[bottomLeftIndex]->removed = true; bottomRightVec[bottomRightIndex]->removed = true; while (true) { if (!topLeftVec[++topLeftIndex]->removed) { break; } } while (true) { if (!topRightVec[++topRightIndex]->removed) { break; } } while (true) { if (!bottomLeftVec[++bottomLeftIndex]->removed) { break; } } while (true) { if (!bottomRightVec[++bottomRightIndex]->removed) { break; } } } double area = (*topLeftVec[topLeftIndex] - *topRightVec[topRightIndex]).length() * (*bottomLeftVec[bottomLeftIndex] - *topRightVec[topRightIndex]).length(); long areaInt = (long)round(area); cout << areaInt << endl; }