#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; constexpr int INF = 1001001001; constexpr int mod = 1000000007; // constexpr int mod = 998244353; template inline bool chmax(T& x, T y){ if(x < y){ x = y; return true; } return false; } template inline bool chmin(T& x, T y){ if(x > y){ x = y; return true; } return false; } using ld = long double; using Point = complex; using Set = vector; const ld pi = acos(-1); constexpr ld eps = 1e-9; constexpr ld inf = 1e12; // 外積 ld cross(const Point& a, const Point& b){ return a.real() * b.imag() - a.imag() * b.real(); } // 内積 ld dot(const Point& a, const Point& b){ return a.real() * b.real() + a.imag() * b.imag(); } enum CCW_RESULT{ CCW = +1, CW = -1, BEHIND = +2, FRONT = -2, ON = 0 }; // b, c に対して、a がどの位置にあるか int ccw(Point a, Point b, Point c){ b -= a, c -= a; if(cross(b, c) > eps) return CCW; // 上側 if(cross(b, c) < -eps) return CW; // 下側 // cross(b, c) == 0 if(dot(b, c) < 0) return BEHIND; // 同一直線上の左側 if(norm(b) < norm(c)) return FRONT; // 同一直線上の右側 return ON; // 線分 ab 上にある } // 直線 (2つの点で表す) struct Line : public vector{ Line(const Point& a = Point(), const Point& b = Point()) : vector(2){ begin()[0] = a; begin()[1] = b; } // Ax + By + C = 0 Line(ld A, ld B, ld C){ if(abs(A) < eps && abs(B) < eps){ abort(); } else if(abs(A) < eps){ *this = Line(Point(0, -C / B), Point(1, -C / B)); } else if(abs(B) < eps){ *this = Line(Point(-C / A, 0), Point(-C / A, 1)); } else{ *this = Line(Point(0, -C / B), Point(-C / A, 0)); } } }; /* 交差判定 */ // 直線と直線 bool intersectLL(const Line& l, const Line& m){ return abs(cross(l[1] - l[0], m[1] - m[0])) > eps || // 平行でない abs(cross(l[1] - l[0], m[0] - l[0])) < eps; // 同じ直線 } // 直線と線分 bool intersectLS(const Line &l, const Line& s){ // cross(l[1] - l[0], s[0] - l[0]) : s[0] が左側 // cross(l[1] - l[0], s[1] - l[0]) : s[1] が右側 return cross(l[1] - l[0], s[0] - l[0]) * cross(l[1] - l[0], s[1] - l[0]) < eps; } // 直線と点 bool intersectLP(const Line& l, const Point& p){ return abs(cross(l[1] - p, l[0] - p)) < eps; } // 線分と線分 bool intersectSS(const Line& s, const Line& t){ return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 && ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0; } // 線分と点 bool intersectSP(const Line& s, const Point& p){ // 三角不等式 return abs(s[0] - p) + abs(s[1] - p) - abs(s[1] - s[0]) < eps; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); Set ps; for(int i = 0; i < 5; ++i){ int x, y; cin >> x >> y; ps.emplace_back(x, y); } vector perm(5); for(int i = 0; i < 5; ++i) perm[i] = i; do { bool ok = true; for(int i = 0; i < 5; ++i){ // r // p q // s t int p = perm[i], q = perm[(i + 1) % 5]; int s = perm[(i + 2) % 5], r = perm[(i + 3) % 5], t = perm[(i + 4) % 5]; auto x = cross(ps[q] - ps[p], ps[r] - ps[p]); auto y = cross(ps[q] - ps[p], ps[s] - ps[p]); if(x * y >= 0 || !intersectSS(Line(ps[p], ps[q]), Line(ps[r], ps[s]))){ ok = false; } y = cross(ps[q] - ps[p], ps[t] - ps[p]); if(x * y >= 0 || !intersectSS(Line(ps[p], ps[q]), Line(ps[r], ps[t]))){ ok = false; } } if(ok){ cout << "YES\n"; return 0; } } while(next_permutation(begin(perm), end(perm))); cout << "NO\n"; return 0; }