-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy path1216C. White Sheet.cpp
54 lines (41 loc) · 1.11 KB
/
1216C. White Sheet.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
#include <bits/stdc++.h>
using namespace std;
int const N = 6;
long long x1[N], y[N], x2[N], y2[N];
long long intersect_area(int rect1, int rect2, int save) {
long long max_x = min(x2[rect1], x2[rect2]);
long long min_x = max(x1[rect1], x1[rect2]);
long long x_diff = max_x - min_x;
long long max_y = max(y[rect1], y[rect2]);
long long min_y = min(y2[rect1], y2[rect2]);
long long y_diff = min_y - max_y;
if(x_diff < 0 || y_diff < 0)
return 0;
x2[save] = max_x;
y2[save] = min_y;
x1[save] = min_x;
y[save] = max_y;
return x_diff * y_diff;
}
long long rectangle_area() {
return (x2[0] - x1[0]) * (y2[0] - y[0]);
}
int main() {
#ifndef ONLINE_JUDGE
freopen("in", "r", stdin);
#endif
for(int i = 0; i < 3; ++i)
scanf("%lld %lld %lld %lld", x1 + i, y + i, x2 + i, y2 + i);
long long _01 = intersect_area(0, 1, 3);
long long _02 = intersect_area(0, 2, 4);
long long _34 = intersect_area(3, 4, 5);
if(_01 == rectangle_area() || _02 == rectangle_area())
puts("NO");
else if(_01 == 0 || _02 == 0)
puts("YES");
else if(_01 + _02 - _34 < rectangle_area())
puts("YES");
else
puts("NO");
return 0;
}