#include using std::swap,std::cin,std::cout,std::ostream,std::endl,std::next_permutation; typedef unsigned int u32; typedef int i32; typedef size_t usize; #define PRINT_VALUE(v){cout<<#v<<" : "< struct Array{ T arr[S]; usize size; Array():size(S){}; T& operator[](usize index){return arr[index];} const T& operator[](usize index)const{return arr[index];} friend ostream& operator<<(ostream &os,Array &a){ cout<<"Array ["; for(usize i=0;iarr; } T* end(){ return this->arr+this->size; } }; int cnt = 0; int partition(int l, int r,int a[]) { cnt += r-l+1; swap(a[l], a[(l+r)/2]); int i = l+1, j = r, x = a[l]; while(1){ while(a[i]x && j>=l+1) j--; if(i>=j) break; swap(a[i],a[j]); i++;j--; } swap(a[l],a[j]); return j; } void qsort(int l, int r,int a[]){ if(l >= r) return; int m = partition(l,r,a);//分 qsort(l,m-1,a);//解 qsort(m+1,r,a); } int main(){ const i32 n=5; Array arr; for(usize i =1;i