#include using namespace std; template istream &operator>>(istream &is,vector &a){ for(auto &v : a) cin >> v; return is; } template ostream &operator<<(ostream &os,const vector &a){ if(a.size() == 0) return os; cout << a.at(0); for(int i=1; i struct Point{ public: T x,y; Point() : x(0),y(0) {} Point(T a,T b) : x(a),y(b) {} Point &operator=(const Point &b) = default; Point operator+(const Point &b){return Point(x+b.x,y+b.y);} Point operator-(const Point &b){return Point(x-b.x,y-b.y);} Point operator+=(const Point &b){return *this=*this+b;} Point operator-=(const Point &b){return *this=*this-b;} bool operator==(const Point &b){return x==b.x && y==b.y;} bool operator!=(const Point &b){return x!=b.x || y!=b.y;} bool operator<(const Point &b){ if(x == b.x) return y < b.y; else return x < b.x; } bool operator<=(const Point &b){return (*this) < b || (*this) == b;} bool operator>(const Point &b){return !((*this) <= b);} bool operator>=(const Point &b){return !((*this) < b);} friend T inner(const Point a,const Point b){return a.x*b.x+a.y*b.y;} friend T cross(const Point a,const Point b){return a.x*b.y-a.y*b.x;} friend T twodist(const Point a,const Point b){return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);}//2乗で返す. }; template istream &operator>>(istream &is,Point &a){ is >> a.x >> a.y; return is; } template ostream &operator<<(ostream &os,Point &a){ os << a.x << " " << a.y; return os; } template vector> Convexhull(vector> &P){ //(x,y)が最小の点から時計回りに頂点を返す. //(xi,yi)と(xi+1,yi+1)は辺になる |P|=1の時注意. sort(P.begin(),P.end()); P.erase(unique(P.begin(),P.end()),P.end()); if(P.size() == 0) return {}; if(P.size() == 1) return {P.at(0),P.at(0)}; vector> A,B; for(auto &p1 : P){ while(A.size() >= 2){ auto &p2 = A.at(A.size()-1); auto &p3 = A.at(A.size()-2); T check = cross(p2-p1,p3-p2); if(check < 0) A.pop_back(); else break; } A.push_back(p1); } for(auto &p1 : P){ while(B.size() >= 2){ auto &p2 = B.at(B.size()-1); auto &p3 = B.at(B.size()-2); T check = cross(p2-p1,p3-p2); if(check > 0) B.pop_back(); else break; } B.push_back(p1); } for(int i=B.size()-2; i>=0; i--) A.push_back(B.at(i)); return A; } int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin >> N >> M; vector S(N); for(auto &s : S) cin >> s; vector> P; for(int i=0; i