#pragma region Region_1 #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(a) a.begin(), a.end() #define rrng(a) a.rbegin(), a.rend() using ll = long long; using P = pair<int, int>; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<ll>; using VVL = vector<VL>; using VP = vector<P>; using VS = vector<string>; using VC = vector<char>; #define MOD 1000000007 const int INF = 1e9 + 10; const long long INFL = 2e18 + 10; // ll max > 9*10^18 template <class T, class C> bool chmax(T& a, C b) { if (a <= b) { a = b; return true; } return false; } template <class T, class C> bool chmin(T& a, C b) { if (a >= b) { a = b; return true; } return false; } template <class T> T sum(const vector<T>& v) { T res = 0; for (size_t i = 0; i < v.size(); ++i) res += v[i]; return res; } ///////////////////////////////////////////////////////// // print like python // https://qiita.com/Lily0727K/items/06cb1d6da8a436369eed ///////////////////////////////////////////////////////// void print() { cout << endl; } template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...); } template <class T> void print(vector<T>& vec) { for (auto& a : vec) { cout << a; if (&a != &vec.back()) cout << " "; } cout << endl; } template <class T> void print(vector<vector<T>>& df) { for (auto& vec : df) { print(vec); } } #pragma endregion Region_1 ///////////////////////////////////////////////////////// #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) struct Point { double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } Point operator*(double a) { return Point(a * x, a * y); } Point operator/(double a) { return Point(x / a, y / a); } double norm() { return x * x + y * y; } // ノルム double abs() { return sqrt(norm()); } // 大きさ bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; } bool operator==(const Point& p) const { return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS; } }; // 線分 struct Segment { Point p1, p2; }; struct Circle { Point c; double r; Circle(Point c = Point(), double r = 0.0) : c(c), r(r) {} }; typedef Point Vector; // ベクトル typedef Segment Line; // 直線 typedef vector<Point> Polygon; // 多角形 // 内積 double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; } // 外積 double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; } /* * a1->a2 と b1->b2 のベクトルの外積 */ double cross(Point a1, Point a2, Point b1, Point b2) { return cross(a2 - a1, b2 - b1); } // 直行判定(内積=0) // 内積 = 0 で判定する bool isOrthogonal(Vector a, Vector b) { return equals(dot(a, b), 0.0); } bool isOrthogonal(Point a1, Point a2, Point b1, Point b2) { return isOrthogonal(a1 - a2, b1 - b2); } bool isOrthogonal(Segment s1, Segment s2) { return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0); } // 並行判定 // 外積の大きさ(|a||b|sin(t)) = 0 で判定する bool isParallel(Vector a, Vector b) { return equals(cross(a, b), 0.0); } bool isParallel(Point a1, Point a2, Point b1, Point b2) { return isParallel(a1 - a2, b1 - b2); } bool isParallel(Segment s1, Segment s2) { return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0); } // 交差判定 bool is_intersected_ls(Point a1, Point a2, Point b1, Point b2) { return (cross(a2 - a1, b1 - a1) * cross(a2 - a1, b2 - a1) < EPS) && // s1 と, s2 の両端との外積2つの積とる (cross(b2 - b1, a1 - b1) * cross(b2 - b1, a2 - b1) < EPS); } // 交差判定 bool is_intersected_ls(Segment s1, Segment s2) { return is_intersected_ls(s1.p1, s1.p2, s2.p1, s2.p2); } // 凸包 Polygon andrewScan(Polygon s) { Polygon sita; if (s.size() < 3) return s; // x 座標順に整列 sort(s.begin(), s.end()); sita.push_back(s[0]); sita.push_back(s[1]); // 下部 for (int i = 2; i < s.size(); i++) { for (int j = sita.size(); j >= 2; j--) { // 外積 < 0 であれば下に凸 if (cross(sita[j - 2], sita[j - 1], sita[j - 1], s[i]) > EPS) { break; } sita.pop_back(); } sita.push_back(s[i]); } // 上部 Polygon ue; ue.push_back(s[s.size() - 1]); ue.push_back(s[s.size() - 2]); for (int i = s.size() - 3; i >= 0; i--) { for (int j = ue.size(); j >= 2; j--) { if (cross(ue[j - 2], ue[j - 1], ue[j - 1], s[i]) > EPS) { break; } ue.pop_back(); } ue.push_back(s[i]); } // merge for (int i = 1; i < ue.size() - 1; i++) { sita.push_back(ue[i]); } return sita; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); std::cout << std::setprecision(28); Polygon p; rep(i, 5) { int x, y; cin >> x >> y; p.push_back({x, y}); } Polygon res= andrewScan(p); if(res.size() ==5){ print("YES"); }else{ print("NO"); } return 0; }