Language: C++


#include<cmath>


#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<utility>
#include<vector>
class Points{
private:
	std::pair<int,int> nCood;
	double dArg;
public:
	Points(){
		nCood.first=nCood.second=dArg=0;
	}
	void SetPoint(int nInX, int nInY){
	nCood.first=nInX;
	nCood.second=nInY;
	return;
	}
	void SetArg(Points StartPoint ){
		
		double dLengthVector=std::sqrt((nCood.first-(StartPoint.nCood).first)*(nCood.first-(StartPoint.nCood).first)+(nCood.second-(StartPoint.nCood).second)*(nCood.second-(StartPoint.nCood).second)*1.);
		double dCos=(nCood.first-(StartPoint.nCood).first)/dLengthVector;
		dArg=std::acos(dCos);
		return;
	}
	std::pair<int,int>nnGetCood(){
	return nCood;
	}
	double dGetArg(){
	return dArg;
	}
};

/*
*?????????????????????
*/
void quick_sort_part(std::vector<Points>&points,int left,int right);
int partition(std::vector<Points>&points,int left,int right);

/*
*??????????¬?????????£(true)??????????????§???i???????????¶?????????????????????????????????
*1<=i<=points.size()-2,i==points.size()-2
*/
bool bCrossProduct (std::vector<Points>&points,int i){
    double dValueCrossPro;
    if(1<=i&&i<=points.size()-2){
     dValueCrossPro = (points[i].nnGetCood().first - points[i-1].nnGetCood().first) * (points[i+1].nnGetCood().second - points[i].nnGetCood().second)
                        -(points[i].nnGetCood().second - points[i-1].nnGetCood().second) * (points[i+1].nnGetCood().first - points[i].nnGetCood().first) ;
    return dValueCrossPro >= 0;
    }
    else if(i==points.size()-1){
     dValueCrossPro = (points[i].nnGetCood().first - points[i-1].nnGetCood().first) * (points[0].nnGetCood().second - points[i].nnGetCood().second)
                        -(points[i].nnGetCood().second - points[i-1].nnGetCood().second) * (points[0].nnGetCood().first - points[i].nnGetCood().first) ;
    return dValueCrossPro >= 0;
    }
    else {
        std::cout<<"errorCrossProduct"<<std::endl;
        return false;}
}

int main(void){
	/*
	*??¶???????????¨???
	*/
	std::ios::sync_with_stdio(false);
	int nInput;
	std::cin >> nInput;
	std::vector<Points> aComp_nPoints(nInput);
	int nInputX,nInputY,nMinX = INT_MAX,nMinY = INT_MAX;
	int nIndexMin;
	for (int i = 0;i < nInput;++i){
		std::cin >> nInputX >> nInputY;
		
			aComp_nPoints[i].SetPoint(nInputX,nInputY);
			if (nMinY > nInputY){
				nMinY = nInputY;
				if (nMinX > nInputX){
				nMinX = nInputX;
				nIndexMin = i;
				}
			}
	}
	/*
	*??¶??????????????§y???????°??????§????????????????????§?????????x????°???????????????¢???
	*/
	if (nIndexMin != 0){
	std::swap(aComp_nPoints[0],aComp_nPoints[nIndexMin]);
	}
	/*
	*aComp_nPoints[0]????????????????§?????±????????°?????????????aComp_nPoints[i>0]?????????????????????
	*/
	for(int i = 1;i < nInput;++i){
		aComp_nPoints[i].SetArg ( aComp_nPoints[0] );
	}
    quick_sort_part(aComp_nPoints,0,aComp_nPoints.size()-1);
	
    std::vector<std::pair<int ,int>> annConvexPoints;
    annConvexPoints.push_back(aComp_nPoints[0].nnGetCood());
    for(int i = 1; i <aComp_nPoints.size()  ;++i){
            if(bCrossProduct (aComp_nPoints, i)){
                annConvexPoints.push_back(aComp_nPoints[i].nnGetCood());
        }
    }
    std::cout << annConvexPoints.size()<<"\n";
    for(int i = 0 ;i < annConvexPoints.size(); ++i){
        std::cout << annConvexPoints[i].first<<" "<<annConvexPoints[i].second<<"\n";
    }

  //  system ("pause");
	return 0;
}

int partition(std::vector<Points>&points,int left,int right){
    double dArg = points[right].dGetArg();
    int iIndex = left-1;
    for (int j = left;j <= right-1;++j){
        if(points[j].dGetArg() <= dArg){
        ++iIndex;
        std::swap(points[iIndex],points[j]);
        }
    }
    std::swap(points[iIndex+1],points[right]);
        return iIndex+1;
}
void quick_sort_part (std::vector<Points>& points,int left,int right){
       if (left<right){
    int nMiddleIndex=partition(points, left, right);
    quick_sort_part ( points, left, nMiddleIndex-1);
    quick_sort_part ( points, nMiddleIndex+1, right);
    }
    return;   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:37: error: 'INT_MAX' was not declared in this scope
   73 |         int nInputX,nInputY,nMinX = INT_MAX,nMinY = INT_MAX;
      |                                     ^~~~~~~
a.cc:10:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    9 | #include<vector>
  +++ |+#include <climits>
   10 | class Points{
a.cc:79:29: error: 'nMinY' was not declared in this scope; did you mean 'nMinX'?
   79 |                         if (nMinY > nInputY){
      |                             ^~~~~
      |                             nMinX