#ifdef NACHIA #define _GLIBCXX_DEBUG #else #define NDEBUG #endif #include #include #include #include using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(i64 i=0; i void chmin(A& l, const A& r){ if(r < l) l = r; } template void chmax(A& l, const A& r){ if(l < r) l = r; } using namespace std; #include namespace nachia{ template struct VecI2 { Int x, y; VecI2() : x(0), y(0) {} VecI2(std::pair _p) : x(std::move(_p.first)), y(std::move(_p.second)) {} VecI2(Int _x, Int _y) : x(std::move(_x)), y(std::move(_y)) {} VecI2& operator+=(VecI2 r){ x+=r.x; y+=r.y; return *this; } VecI2& operator-=(VecI2 r){ x-=r.x; y-=r.y; return *this; } VecI2& operator*=(Int r){ x*=r; y*=r; return *this; } VecI2 operator+(VecI2 r) const { return VecI2(x+r.x, y+r.y); } VecI2 operator-(VecI2 r) const { return VecI2(x-r.x, y-r.y); } VecI2 operator*(Int r) const { return VecI2(x*r, y*r); } VecI2 operator-() const { return VecI2(-x, -y); } Int2 operator*(VecI2 r) const { return Int2(x) * Int2(r.x) + Int2(y) * Int2(r.y); } Int2 operator^(VecI2 r) const { return Int2(x) * Int2(r.y) - Int2(y) * Int2(r.x); } bool operator<(VecI2 r) const { return x < r.x || (!(r.x < x) && y < r.y); } Int2 norm() const { return Int2(x) * Int2(x) + Int2(y) * Int2(y); } Int2 manhattan() const { return std::abs(x) + std::abs(y); } static bool compareYX(VecI2 a, VecI2 b){ return a.y < b.y || (!(b.y < a.y) && a.x < b.x); } static bool compareXY(VecI2 a, VecI2 b){ return a.x < b.x || (!(b.x < a.x) && a.y < b.y); } bool operator==(VecI2 r) const { return x == r.x && y == r.y; } bool operator!=(VecI2 r) const { return x != r.x || y != r.y; } }; } // namespace nachia namespace nachia{ // border = true is buggy template std::vector convexHull(std::vector> points, bool border = false) { int n = points.size(); if(n == 0) return {}; std::vector ord(n); for(int i=0; i bool { if(points[l].x != points[r].x) return points[l].x < points[r].x; return points[l].y < points[r].y; }); if(points[ord.front()] == points[ord.back()]){ return std::vector(1,0); } std::vector res; int ressz = 0; for(int t=0; t<2; t++){ for(int p : ord){ Int2 x0 = points[p].x, y0 = points[p].y; while(ressz + 2 <= (int)res.size()){ int q = res.back(); Int2 x1 = points[q].x - x0, y1 = points[q].y - y0; res.pop_back(); Int2 x2 = points[res.back()].x - x0, y2 = points[res.back()].y - y0; if(border ? (x1 * y2 > x2 * y1) : (x1 * y2 >= x2 * y1)) continue; res.push_back(q); break; } res.push_back(p); } if(t == 0) std::reverse(ord.begin(), ord.end()); res.pop_back(); ressz = res.size(); } return res; } } // namespace nachia void testcase(){ i64 N; cin >> N; auto vs = vector>(N); for(auto& [x,y] : vs) cin >> x >> y; auto ch = nachia::convexHull(vs); cout << (ch.size() == N ? "Yes\n" : "No\n"); } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); testcase(); return 0; }