private void sort(int[][] points,int begin,int end){
int mid;
if(begin<end){
mid=part(points,begin,end);
sort(points,mid+1,end);
sort(points,begin,mid-1);
}
}
private int part(int[][] points,int begin,int end){
int temp0=points[begin][0];
int temp1=points[begin][1];
while(begin<end){
while(begin<end&&points[end][0]>=temp0){
end--;
}
points[begin][0]=points[end][0];
points[begin][1]=points[end][1];
while(begin<end&&points[begin][0]<=temp0){
begin++;
}
points[end][0]=points[begin][0];
points[end][1]=points[begin][1];
}
points[begin][0]=temp0;
points[begin][1]=temp1;
return begin;
}
int mid;
if(begin<end){
mid=part(points,begin,end);
sort(points,mid+1,end);
sort(points,begin,mid-1);
}
}
private int part(int[][] points,int begin,int end){
int temp0=points[begin][0];
int temp1=points[begin][1];
while(begin<end){
while(begin<end&&points[end][0]>=temp0){
end--;
}
points[begin][0]=points[end][0];
points[begin][1]=points[end][1];
while(begin<end&&points[begin][0]<=temp0){
begin++;
}
points[end][0]=points[begin][0];
points[end][1]=points[begin][1];
}
points[begin][0]=temp0;
points[begin][1]=temp1;
return begin;
}