classSolution{public:staticboolcmp(const vector<int>& a,const vector<int>& b){if(a[0]== b[0])return a[1]< b[1];return a[0]> b[0];}
vector<vector<int>>reconstructQueue(vector<vector<int>>& people){sort(people.begin(), people.end(), cmp);
vector<vector<int>> que;for(int k =0; k < people.size();++k){int position = people[k][1];
que.insert(que.begin()+ position, people[k]);}return que;}};
452. 用最少数量的箭引爆气球
classSolution{public:staticboolcmp(const vector<int>& a,const vector<int>& b){return a[0]< b[0];}intfindMinArrowShots(vector<vector<int>>& points){if(points.size()==0)return0;sort(points.begin(), points.end(), cmp);int result =0;int left = points[0][0];int right = points[0][1];
result +=1;for(int i =1; i < points.size();++i){
left = points[i][0];
right =min(right, points[i][1]);if(left <= right){continue;}else{
result++;
right = points[i][1];}}return result;}};