#include using namespace std; int distSquare (int x1, int y1, int x2, int y2) { int d = (x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1); return d; } int calcX(int x1, int x2, int x3) { return x1 + x3 - x2; } int calcY(int y1, int y2, int y3) { return y1 + y3 - y2; } int main() { int X1,X2,X3,Y1,Y2,Y3; cin >> X1 >> Y1 >> X2 >> Y2 >> X3 >> Y3; int d12, d23, d31; d12 = distSquare(X1, Y1, X2, Y2); d23 = distSquare(X2, Y2, X3, Y3); d31 = distSquare(X3, Y3, X1, Y1); if (d12 != d23 && d23 != d31 && d31 != d12) { cout << -1 << endl; return 0; } if (d12 == d23 && d23 == d31 && d31 == d12) { cout << -1 << endl; return 0; } if (d12 == d23) { bool is = ((X2 - X1) * (X3 - X2) + (Y2 - Y1) * (Y3 - Y2) == 0); if (is) { int ansX = calcX(X1, X2, X3); int ansY = calcY(Y1, Y2, Y3); cout << ansX << " " << ansY << endl; } else { cout << -1 << endl; } return 0; } if (d23 == d31) { bool is = ((X3 - X2) * (X1 - X3) + (Y3 - Y2) * (Y1 - Y3) == 0); if (is) { int ansX = calcX(X2, X3, X1); int ansY = calcY(Y2, Y3, Y1); cout << ansX << " " << ansY << endl; } else { cout << -1 << endl; } return 0; } if (d31 == d12) { bool is = ((X1 - X3) * (X2 - X1) + (Y1 - Y3) * (Y2 - Y1) == 0); if (is) { int ansX = calcX(X3, X1, X2); int ansY = calcY(Y3, Y1, Y2); cout << ansX << " " << ansY << endl; } else { cout << -1 << endl; } return 0; } }