//https://www.acmicpc.net/problem/2751 #include using namespace std; int arr[1000001];int n; void partition(int left, int right){ if(left==right) return; else if(left+1==right){ //한 칸 차이 일 때, 정렬 if(arr[left]>arr[right]){ int tmp=arr[left]; arr[left]=arr[right]; arr[right]=tmp; } return; } int mid=(left+right)/2; partition(left, mid); partition(mid+1, right); //분할 int *sortedarr = new int[right-l..
//https://www.acmicpc.net/problem/2751 #include using namespace std; int arr[1000001];int n;void swap(int a, int b){ int tmp=arr[a]; arr[a]=arr[b]; arr[b]=tmp; return;}int partition(int low, int high){ int pivotidx=low+(high-low)/2; int pivotval=arr[pivotidx]; swap(pivotidx, high);//pivot을 오른쪽으로 보내줌 int stridx=low; for(int i=low; i arr[i]; quick_sort(0,n-1); for(int i=0; i