#include #include #include #include #include #include #include #include using namespace std; #define REP(i,first,last) for (int i=first;i y ? x : y) #define MIN(x,y) (x < y ? x : y) typedef pair p_ii; vector points; int get_distance(p_ii p_1, p_ii p_2){ int x = pow(p_1.first - p_2.first, 2); int y = pow(p_1.second - p_2.second, 2); return x + y; } int main(){ for (int i=0;i<3;i++) { p_ii p; cin >> p.first; cin >> p.second; points.push_back(p); } // 最初の点を適当に決め、残り二つのうちから距離が近い方を二番目の点にする p_ii p_1 = points[0]; int dis_1 = get_distance(points[0], points[1]); int dis_2 = get_distance(points[0], points[2]); p_ii p_2 = MIN(dis_1, dis_2) == dis_1 ? points[1] : points[2]; // 2点間のxとyの差から、正方形になるための点候補を四つ挙げる int x_dif = p_2.first - p_1.first; int y_dif = p_2.second - p_1.second; p_ii p_3 = {p_1.first + y_dif, p_1.second - x_dif}; p_ii p_4 = {p_1.first - y_dif, p_1.second + x_dif}; p_ii p_5 = {p_2.first + y_dif, p_2.second - x_dif}; p_ii p_6 = {p_2.first - y_dif, p_2.second + x_dif}; // 残りの一点が候補内にあれば正方形ができる p_ii rest_p = p_2 == points[1] ? points[2] : points[1]; if (rest_p == p_3) { cout << p_5.first << " " << p_5.second << endl; } else if (rest_p == p_4) { cout << p_6.first << " " << p_6.second << endl; } else if (rest_p == p_5) { cout << p_3.first << " " << p_3.second << endl; } else if (rest_p == p_6) { cout << p_4.first << " " << p_4.second << endl; } else { cout << -1 << endl; } }