#include #include #include #include #include #include #include #include #include #include #include using namespace std; template struct point{ T x, y; }; //judge if line AB intersects line CD template bool intersect(point &a, point &b, point &c, point &d){ bool ans = 1; T s, t; s = (a.x - b.x) * (c.y - a.y) - (a.y - b.y) * (c.x - a.x); t = (a.x - b.x) * (d.y - a.y) - (a.y - b.y) * (d.x - a.x); if (s*t > 0) ans = 0; s = (c.x - d.x) * (a.y - c.y) - (c.y - d.y) * (a.x - c.x); t = (c.x - d.x) * (b.y - c.y) - (c.y - d.y) * (b.x - c.x); if (s*t > 0) ans = 0; return ans; } //Euclidean distance between A and B template T dist(point &a, point &b, bool square = false){ T d = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y); return (square ? d : sqrt(d)); } //Inner product of vectors AB and CD template T innerp(point &a, point &b, point &c, point &d){ return (b.x - a.x) * (d.x - c.x) + (b.y - a.y) * (d.y - c.y); } //Cross product of vectors AB and CD template T crossp(point &a, point &b, point &c, point &d){ return (b.x - a.x) * (d.y - c.y) - (b.y - a.y) * (d.x - c.x); } //Calculate the area of triangle ABC template T heron(point &a, point &b, point &c){ return abs(crossp(a, b, a, c)) / 2; } //Convex Hull(Smallest Convex set containing all given points) //Grahum Scan (O(NlogN)) template vector> convex_hull(vector> P){ sort(P.begin(), P.end(), [](point &p1, point &p2) { if (p1.x != p2.x) return p1.x < p2.x; return p1.y < p2.y; }); int N=P.size(), k=0, t; vector> res(N*2); for (int i=0; i 1 && crossp(res[k-2], res[k-1], res[k-1], P[i]) <= 0) k--; res[k] = P[i]; k++; } t = k; for (int i=N-2; i>=0; i--){ while(k > t && crossp(res[k-2], res[k-1], res[k-1], P[i]) <= 0) k--; res[k] = P[i]; k++; } res.resize(k-1); return res; } int main(){ vector> P(5); for (auto &[x, y] : P) cin >> x >> y; cout << (convex_hull(P).size() == 5 ? "YES" : "NO") << endl; return 0; }