-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicpc2527.cpp
More file actions
42 lines (39 loc) · 1.08 KB
/
icpc2527.cpp
File metadata and controls
42 lines (39 loc) · 1.08 KB
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
#include <iostream>
using namespace std;
using lint = long long int;
struct Rect{
lint bx, by;
lint tx, ty;
};
int main(){
for(int i = 0; i < 4; i++){
Rect r1, r2;
bool x_meet, y_meet, x_intersect, y_intersect;
cin >> r1.bx >> r1.by >> r1.tx >> r1.ty;
cin >> r2.bx >> r2.by >> r2.tx >> r2.ty;
x_meet = (r1.bx == r2.tx) || (r1.tx == r2.bx);
y_meet = (r1.by == r2.ty) || (r1.ty == r2.by);
x_intersect = (r1.tx - r1.bx + r2.tx - r2.bx) > max(r1.tx - r2.bx, r2.tx - r1.bx);
y_intersect = (r1.ty - r1.by + r2.ty - r2.by) > max(r1.ty - r2.by, r2.ty - r1.by);
if(x_meet){
if(y_meet)
cout << "c";
else if(y_intersect)
cout << "b";
else
cout << "d";
}
else if(x_intersect){
if(y_meet)
cout << "b";
else if(y_intersect)
cout << "a";
else
cout << "d";
}
else
cout << "d";
cout << '\n';
}
return 0;
}