#include #include #include #include using namespace std; typedef long long ll; struct co2d { //2次元座標のクラス ll x, y; co2d() { x = 0, y = 0; } co2d(ll a, ll b) { x = a, y = b; } bool operator== (const co2d& b) { return (*this).x == b.x && (*this).y == b.y; } co2d& operator=(const co2d& b) { (*this).x = b.x, (*this).y = b.y; return (*this); } co2d& operator+=(const co2d& b) { x += b.x, y += b.y; return (*this); } co2d& operator+(const co2d& b) const{ return co2d(*this) += b; } co2d& operator-=(const co2d& b) { x -= b.x, y -= b.y; return (*this); } co2d& operator-(const co2d& b) const { return co2d(*this) -= b; } ll dot(const co2d& b) { //return value is scalar. return x * b.x + y * b.y; } ll cross(const co2d& b) { //From the veiw point of deifne, cross product is vector. //but int 2d, cross product is also schalar value. return x * b.y - y * b.x; } }; namespace convex_hull { vector ans; void calc(vector& candidate) { const int Size = candidate.size(); vector> sortlist; for (int i = 0; i < Size; i++) { if (candidate[i] == co2d(0, 0))sortlist.push_back(make_pair(0, i)); else sortlist.push_back(make_pair(atan2(candidate[i].y, candidate[i].x), i)); } sort(sortlist.begin(), sortlist.end()); ll sx = candidate[0].x, sy = candidate[0].y; int idx = 0; for (int i = 1; i < Size; i++) { if (sx >= candidate[i].x && sy >= candidate[i].y) { sx = candidate[i].x, sy = candidate[i].y, idx = i; } } for (int i = 0; i < Size; i++) { if (sortlist[i].second == idx) { idx = i; break; } } ans.push_back(idx); ans.push_back((idx + 1) % Size); for (int i = idx + 2; i < Size + idx; i++) { while (ans.size() >= 2 && co2d(candidate[ans.back()] - candidate[ans[ans.size() - 2]]). cross(co2d(candidate[sortlist[i % Size].second] - candidate[ans.back()])) <= 0) { //不適格な点を取り除く ans.pop_back(); } ans.push_back(sortlist[i % Size].second); } } } int main() { vector pos(5); for (int i = 0; i < 5; i++)cin >> pos[i].x >> pos[i].y; convex_hull::calc(pos); if (convex_hull::ans.size() == 5) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }