-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsol.cpp
More file actions
executable file
·54 lines (45 loc) · 1015 Bytes
/
Copy pathsol.cpp
File metadata and controls
executable file
·54 lines (45 loc) · 1015 Bytes
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
#include <bits/stdc++.h>
using namespace std;
int main()
{
int min_x, min_y, max_x, max_y;
set<pair<int, int>> points;
for (int i = 0; i < 3; ++i)
{
int x, y;
cin >> x >> y;
points.insert({x, y});
if (i == 0)
{
min_x = x;
max_x = x;
min_y = y;
max_y = y;
}
else
{
min_x = min(x, min_x);
max_x = max(x, max_x);
min_y = min(y, min_y);
max_y = max(y, max_y);
}
}
// Test all four options
if (points.find({min_x, min_y}) == points.end())
{
cout << min_x << " " << min_y << endl;
}
else if (points.find({min_x, max_y}) == points.end())
{
cout << min_x << " " << max_y << endl;
}
else if (points.find({max_x, min_y}) == points.end())
{
cout << max_x << " " << min_y << endl;
}
else
{
cout << max_x << " " << max_y << endl;
}
return 0;
}