-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path124.cpp
52 lines (50 loc) · 1.08 KB
/
124.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
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
struct point{
double x,y;
};
struct edge{
point a,b;
}e[10101];
int n;
point p1;
int main(){
//init
std::ios::sync_with_stdio(false);
cin >> n;
for (int i=1;i<=n;++i){
cin >> e[i].a.x >> e[i].a.y
>> e[i].b.x >> e[i].b.y;
if (e[i].a.x==e[i].b.x &&
e[i].a.y>e[i].b.y) swap(e[i].a.y,e[i].b.y);
if (e[i].a.y==e[i].b.y &&
e[i].a.x>e[i].b.x) swap(e[i].a.x,e[i].b.x);
}
cin >> p1.x >> p1.y;
//solve
for (int i=1;i<=n;++i){
if (e[i].a.x==e[i].b.x && e[i].a.x==p1.x &&
e[i].a.y<=p1.y && e[i].b.y>=p1.y){
cout << "BORDER" << endl;
return 0;
}
else if (e[i].a.y==e[i].b.y && e[i].a.y==p1.y &&
e[i].a.x<=p1.x && e[i].b.x >=p1.x){
cout << "BORDER" << endl;
return 0;
}
}
int k=0;
for (int i=1;i<=n;++i){
if ((e[i].a.y == e[i].b.y) && (e[i].a.y>p1.y) &&
(e[i].a.x<p1.x) && (e[i].b.x>=p1.x))
k++;
}
//print
if (k & 1==1) cout << "INSIDE" << endl;
else cout << "OUTSIDE" << endl;
return 0;
}