#include #include #include #include #include #include using namespace std; #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) // 二次元上の点を表す型 class Point { public: int x, y; Point(int x = 0, int y = 0) : x(x), y(y) {} Point operator+(const Point& p) { return Point(x + p.x, y + p.y); } Point operator-(const Point& p) { return Point(x - p.x, y - p.y); } Point operator*(int k) { return Point(x * k, y * k); } Point operator/(int k) { return Point(x / k, y / k); } int norm() { return x * x + y * y; } int abs() { return sqrt(norm()); } bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; } bool operator==(const Point& p) const { return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS; } }; // ベクトルを表す構造体 typedef Point Vector; // ベクトルのノルムを計算する int norm(Vector a) { return a.x * a.x + a.y * a.y; } // ベクトル a とベクトル b の内積を求める int dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; } int main() { int x1, y1, x2, y2, x3, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; Point p1 = Point(x1, y1), p2 = Point(x2, y2), p3 = Point(x3, y3); Vector v1 = p2 - p1, v2 = p3 - p1, v3 = v2 - v1, v4 = v1 - v2; Point p4; if (dot(v1, v2) == 0 && norm(v1) == norm(v2)) { p4 = v1 + v2; cout << p4.x << " " << p4.y << endl; } else if (dot(v1, v3) == 0 && norm(v1) == norm(v3)) { p4 = p1 + v3; cout << p4.x << " " << p4.y << endl; } else if (dot(v2, v4) == 0 && norm(v2) == norm(v4)) { p4 = p1 + v4; cout << p4.x << " " << p4.y << endl; } else { cout << -1 << endl; } return 0; }