Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 1 KBi |
#2 |
Correcto
|
0.004 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 2 KBi |
#4 |
Correcto
|
0.005 s | 7 KBi |
#5 |
Correcto
|
0.005 s | 1 KBi |
#6 |
Correcto
|
0.005 s | 7 KBi |
#7 |
Correcto
|
0.004 s | 16 KBi |
#8 |
Correcto
|
0.002 s | 13 KBi |
#9 |
Correcto
|
0.003 s | 0 KBi |
#10 |
Correcto
|
0.005 s | 1 KBi |
#11 |
Incorrecto
|
0.002 s | 1 KBi |
#12 |
Incorrecto
|
0.003 s | 11 KBi |
#13 |
Incorrecto
|
0.003 s | 0 KBi |
#14 |
Correcto
|
0.006 s | 2 KBi |
#15 |
Correcto
|
0.004 s | 10 KBi |
#16 |
Correcto
|
0.004 s | 2 KBi |
#17 |
Correcto
|
0.006 s | 24 KBi |
#18 |
Incorrecto
|
0.004 s | 12 KBi |
#19 |
Incorrecto
|
0.005 s | 30 KBi |
#20 |
Incorrecto
|
0.004 s | 7 KBi |
#include<iostream> using namespace std; void quick(long long* arr,long long size){ if(size>=2){ long long pivot=arr[size/2]; long long i,j,tem; for(i=0,j=size-1;;i++,j--){ while(arr[i]<pivot)i++; while(arr[j]>pivot)j--; if(i>=j)break; tem= arr[i]; arr[i]=arr[j]; arr[j]=tem; } quick(arr,i); quick(arr,size-i); } } int main(){ long long n;cin>>n; long long arr[n]; for(long long i=0;i<n;i++)cin>>arr[i]; quick(arr,n); for(long long i=0;i<n;i++)cout<<arr[i]<<" "; return 0; }