#include #include using namespace std; typedef long long int lli; struct Point { long long int x; long long int y; }; int n; set points; lli distance(Point a, Point b) { lli dx = a.x - b.x; lli dy = a.y - b.y; return dx*dx + dy*dy; } bool operator<(const Point& left, const Point& right) { if (left.x + left.y == right.x + right.y) { return left.y < right.y; } return left.x + left.y < right.x + right.y; } bool hasNext(Point a1, Point a2, Point &a3) { a3 = Point{a2.x+a1.y-a2.y, a2.y-a1.x+a2.x}; // cout << " checking " << a3.x << " " << a3.y <> n; lli sum = 0; for (int i = 0; i < 4 * n; ++i) { long long int x; cin >> x; long long int y; cin >> y; points.insert({x, y}); } while (points.size()) { // cout << "SIZE B " << points.size() < distance(cur, other)) { shortest = other; } } Point p1=cur, p2=shortest, p3, p4; getSquare(p1, p2, p3, p4); lli d = distance(p1, p2); sum += d; // cout << "Found square of side" << d <