// Wrongri-La Shower // まともな幾何ライブラリをつくろうな #include #include #include #include // double struct P{ P(){} P(double _r, double _i):r(_r), i(_i){} void real(const double& v){r = v;} void imag(const double& v){i = v;} P& operator-=(const P& rhs){ this->r -= rhs.r; this->i -= rhs.i; return *this; } bool operator<(const P& rhs) const{ if(this->r == rhs.r){ return this->i < rhs.i; } return this->r < rhs.r; } double r, i; }; double real(const P& p){return p.r;} double imag(const P& p){return p.i;} double norm(const P& p){double r = real(p), i = imag(p); return r * r + i * i;} double dist(const P& p){return std::sqrt(norm(p));} P operator+(const P& lhs, const P& rhs){ return P(real(lhs)+real(rhs), imag(lhs)+imag(rhs)); } P operator-(const P& lhs, const P& rhs){ return P(real(lhs)-real(rhs), imag(lhs)-imag(rhs)); } P operator-(const P& p){ return P(-real(p), -imag(p)); } double cross(const P& lhs, const P& rhs){ return real(lhs)*imag(rhs) - imag(lhs)*real(rhs); } double dot(const P& lhs, const P& rhs){ return real(lhs)*real(rhs) + imag(lhs)*imag(rhs); } // 全然つかったことのないccw int ccw(P a, P b, P c){ b -= a; c -= a; if(cross(b, c) > 0)return 1; // counter clock wise if(cross(b, c) < 0)return -1; // clock wise if(dot(b, c) < 0)return 2; // B A C if(norm(b) < norm(c))return -2; // A B C return 0; // A C B } // Convex-Hull std::vector

convex_hull(std::vector

ps){ int n = ps.size(), k = 0; std::sort(ps.begin(), ps.end()); std::vector

ch(2*n); for(int i=0;i=2&&ccw(ch[k-2], ch[k-1], ps[i])<=0){--k;} // 反時計になるよう調整 } for(int i=n-2, t=k+1;i>=0;ch[k++]=ps[i--]){ // 上 while(k>=t&&ccw(ch[k-2], ch[k-1], ps[i])<=0){--k;} } ch.resize(k-1); // 輪を閉じる部分(最初と最後)の重複を除く return ch; } int main(){ std::vector

polygon; for(int i=0;i<5;i++){ double x, y; scanf("%lf %lf", &x, &y); polygon.emplace_back(x, y); } if(convex_hull(polygon).size() == 5){ puts("YES"); }else{ puts("NO"); } }