-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9063.cpp
More file actions
54 lines (50 loc) · 1019 Bytes
/
9063.cpp
File metadata and controls
54 lines (50 loc) · 1019 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
// 9063. 대지
// 2022.04.06
// 기하학
#include<iostream>
#include<vector>
using namespace std;
int main()
{
int n;
cin >> n;
int ans = 0;
int a, b;
if (n == 1)
{
cin >> a >> b;
ans = 0;
}
else
{
pair<int, int> xPos;
pair<int, int> yPos;
xPos.first = 987564321;
xPos.second = -987654321;
yPos.first = 987564321;
yPos.second = -987654321;
for (int i = 0; i < n; i++)
{
cin >> a >> b;
if (a < xPos.first)
{
xPos.first = a;
}
if (a > xPos.second)
{
xPos.second = a;
}
if (b < yPos.first)
{
yPos.first = b;
}
if (b > yPos.second)
{
yPos.second = b;
}
}
ans = (xPos.second - xPos.first) * (yPos.second - yPos.first);
}
cout << ans << endl;
return 0;
}