1 solutions
-
0
#include<bits/stdc++.h> using namespace std; void qsort(int a[],int start,int end){ if(start>=end)return; int left=start,right=end,pivot=a[(start+end)/2]; do{ while(a[left]<pivot) left++; while(a[right]>pivot) right--; if(left<=right){ swap(a[left],a[right]); left++; right--; } }while(left<=right); qsort(a,start,right); qsort(a,left,end); } int main(){ int n; cin>>n; int a[n]; for(int i=1;i<=n;i++){ cin>>a[i]; } qsort(a[n],1,n); for(int i=1;i<=n;i++){ cout<<a[i]; } return 0; }
- 1
Information
- ID
- 325
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 5
- Tags
- # Submissions
- 30
- Accepted
- 5
- Uploaded By