-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path459a.cpp
59 lines (55 loc) · 1.05 KB
/
459a.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
using namespace std;
int main() {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int a, b;
if (x1 == x2) {
a = y1 - y2;
if (a < 0)
a = -a;
if (x1 + a <= 1000) {
cout << x1+a << ' ' << y1 << ' ';
cout << x1+a << ' ' << y2 << endl;
}
else if (x1 - a >= -1000) {
cout << x1-a << ' ' << y1 << ' ';
cout << x1-a << ' ' << y2 << endl;
}
else {
cout << -1 << endl;
}
}
else if (y1 == y2) {
a = x1 - x2;
if (a < 0)
a = -a;
if (y1 + a <= 1000) {
cout << x1 << ' ' << y1+a << ' ';
cout << x2 << ' ' << y1+a << endl;
}
else if (y1 - a >= -1000) {
cout << x1 << ' ' << y1-a << ' ';
cout << x2 << ' ' << y1-a << endl;
}
else {
cout << -1 << endl;
}
}
else {
a = x1 - x2;
if (a < 0)
a = -a;
b = y1 - y2;
if (b < 0)
b = -b;
if (a == b) {
cout << x1 << ' ' << y2 << ' ';
cout << x2 << ' ' << y1 << endl;
}
else {
cout << -1 << endl;
}
}
return 0;
}