//////////////////////////////////////// /// tu3 pro-con template /// //////////////////////////////////////// #include "bits/stdc++.h" using namespace std; // -- loop macros -- // #define REP(i,n) for (int i = 0; i < (n); i++) #define RREP(i,n) for (int i = (n)-1; i >= 0; i--) #define FOR(i,s,n) for (int i = (int)(s); i < (n); i++) #define RFOR(i,s,n) for (int i = (n)-1; i >= (s); i--) #define FOREACH(i,container) for (auto &&i : container) #define allof(c) c.begin(), c.end() #define partof(c,i,n) c.begin() + (i), c.begin() + (i) + (n) // -- functors -- // #define PREDICATE(t,a,exp) [&](const t & a) -> bool { return exp; } #define COMPARISON(t,a,b,exp) [&](const t & a, const t & b) -> bool { return exp; } #define PRED(a,exp) [&](const auto & a) -> bool { return exp; } #define COMP(a,b,exp) [&](const auto & a, const auto & b) -> bool { return exp; } #define CONV1(a,exp) [&](const auto & a) -> auto { return exp; } #define CONV2(a,b,exp) [&](const auto & a, const auto & b) -> auto { return exp; } #define CONV3(a,b,c,exp) [&](const auto & a, const auto & b, const auto & c) -> auto { return exp; } // -- typedefs -- // #define EPS 1e-9 typedef unsigned int uint; typedef long long llong; typedef unsigned long long ullong; // -- I/O Helper -- // struct _Reader { _Reader(istream &cin) :cin(cin) {} istream &cin; template _Reader operator ,(T &rhs) { cin >> rhs; return *this; } }; struct _Writer { _Writer(ostream &cout) :cout(cout) {} ostream &cout; bool f{ false }; template _Writer operator ,(const T &rhs) { cout << (f ? " " : "") << rhs; f = true; return *this; } }; #define READ(t,...) t __VA_ARGS__; (_Reader{cin}), __VA_ARGS__ #define WRITE(...) (_Writer{cout}), __VA_ARGS__; cout << '\n' #define DEBUG(...) (_Writer{cerr}), __VA_ARGS__; cerr << '\n' // -- vevector -- // template struct vevector : public vector> { vevector(size_t n = 0, size_t m = 0, const T &initial = T()) : vector>(n, vector(m, initial)) { } }; template struct vevevector : public vector> { vevevector(size_t n = 0, size_t m = 0, size_t l = 0, const T &initial = T()) : vector>(n, vevector(m, l, initial)) { } }; template struct vevevevector : public vector> { vevevevector(size_t n = 0, size_t m = 0, size_t l = 0, size_t k = 0, const T &initial = T()) : vector>(n, vevevector(m, l, k, initial)) { } }; namespace std { template inline istream & operator >> (istream & in, pair &p) { in >> p.first >> p.second; return in; } template inline ostream & operator << (ostream &out, const pair &p) { out << p.first << " " << p.second; return out; } } template T read() { T t; cin >> t; return t; } template vector read(int n) { vector v; REP(i, n) { v.push_back(read()); } return v; } template vevector read(int n, int m) { vevector v; REP(i, n) v.push_back(read(m)); return v; } template vector readjag() { return read(read()); } template vevector readjag(int n) { vevector v; REP(i, n) v.push_back(readjag()); return v; } template struct iter_pair_t { T beg, end; }; template iter_pair_t iter_pair(T beg, T end) { return iter_pair_t{beg, end}; } template ostream & operator << (ostream &out, iter_pair_t v) { if (v.beg != v.end) { out << *v.beg++; while (v.beg != v.end) { out << " " << *v.beg++; } } return out; } template ostream & operator << (ostream &out, const vector &v) { return out << iter_pair(begin(v), end(v)); } // -- etc -- // template T infinity_value(); #define DEFINE_INFINITY_VALUE(T, val) template <> constexpr T infinity_value() { return (val); } DEFINE_INFINITY_VALUE(int, 1 << 28); DEFINE_INFINITY_VALUE(uint, 1u << 28); DEFINE_INFINITY_VALUE(llong, 1ll << 60); DEFINE_INFINITY_VALUE(ullong, 1ull << 60); DEFINE_INFINITY_VALUE(double, HUGE_VAL); DEFINE_INFINITY_VALUE(float, HUGE_VAL); #define INF(T) infinity_value() inline int sign_of(double x) { return (abs(x) < EPS ? 0 : x > 0 ? 1 : -1); } template bool in_range(TInt val, TInt min, TInt max) { return val >= min && val < max; } template <> bool in_range(double val, double min, double max) { return val - min > -EPS && val - max < EPS; } template <> bool in_range(float val, float min, float max) { return val - min > -EPS && val - max < EPS; } template bool in_range2d(TInt x, TInt y, TInt w, TInt h) { return x >= 0 && x < w && y >= 0 && y < h; } vector iotavn(int start, int count) { vector r(count); iota(allof(r), start); return r; } //// start up //// void solve(); int main() { //// for local debugging //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); //auto classic_table = ctype::classic_table(); //vector::mask> ctable(classic_table, classic_table + ctype::table_size); //ctable[':'] |= ctype_base::space; // as delimitor //ctable['/'] |= ctype_base::space; // as delimitor //cin.imbue(locale(cin.getloc(), new ctype(ctable.data()))); cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed; cout << setprecision(std::numeric_limits::max_digits10); solve(); return 0; } //////////////////// /// template end /// //////////////////// // 平面上の点。もしくは平面上のベクトル。 struct P2 { double x, y; P2(double x = 0, double y = 0) : x(x), y(y) { } P2 operator +() const { return *this; } P2 operator +(const P2 &_) const { return { x + _.x, y + _.y }; } P2& operator +=(const P2 &_) { x += _.x, y += _.y; return *this; } P2 operator -() const { return { -x, -y }; } P2 operator -(const P2 &_) const { return *this + -_; } P2& operator -=(const P2 &_) { x -= _.x, y -= _.y; return *this; } P2 operator *(double _) const { return { x*_, y*_ }; } P2 operator /(double _) const { return { x / _, y / _ }; } double dot(const P2 &_) const { return x * _.x + y * _.y; } // 内積 double cross(const P2 &_) const { return x * _.y - y * _.x; } // 外積 double sqlength() const { return x * x + y * y; } // 二乗長さ double length() const { return sqrt(sqlength()); } // 長さ P2 orthogonal() const { return { -y, x }; } P2 direction() const { return *this / length(); } // 方向ベクトル double arg() const { return atan2(y, x); } static P2 polar(double length, double theta) { return P2(std::polar(length, theta).real(), std::polar(length, theta).imag()); } }; inline istream & operator>>(istream & in, P2 & p) { in >> p.x >> p.y; return in; } inline ostream & operator<<(ostream & out, const P2 & p) { out << p.x << ' ' << p.y; return out; } /// 点集合の凸包 O(n log n) typedef int Index; vector convex_hull(const vector &points) { int N = points.size(); if (N == 0) { return {}; } if (N == 1) { return { 0 }; } if (N == 2) { return { 0,1 }; } vector pidx(N); REP(i, N) { pidx[i] = i; } auto cmpP2 = COMPARISON(P2, a, b, a.x != b.x ? a.x < b.x : a.y < b.y); sort(allof(pidx), COMPARISON(Index, a, b, cmpP2(points[a], points[b]))); vector ret; ret.reserve(N * 2); auto cw = [](P2 a, P2 b, P2 c) { return (b - a).cross(c - a) > EPS; }; auto f = [&](int K, int i) { while (ret.size() > K) { P2 a = points[ret[ret.size() - 2]]; P2 b = points[ret[ret.size() - 1]]; P2 c = points[pidx[i]]; if (cw(a, b, c)) { break; } ret.pop_back(); } ret.push_back(pidx[i]); }; REP(i, N) { f(1, i); } int K = ret.size(); RREP(i, N - 1) { f(K, i); } ret.pop_back(); return ret; } void solve() { WRITE(convex_hull(read(5)).size() == 5 ? "YES" : "NO"); }