Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.022 s | 3 KBi |
#2 |
Correcto
|
0.033 s | 3 KBi |
#3 |
Correcto
|
0.026 s | 3 KBi |
#4 |
Correcto
|
0.019 s | 3 KBi |
#5 |
Correcto
|
0.022 s | 3 KBi |
#6 |
Correcto
|
0.029 s | 3 KBi |
#7 |
Correcto
|
0.883 s | 5 KBi |
#8 |
Correcto
|
0.905 s | 7 KBi |
#9 |
Correcto
|
0.864 s | 5 KBi |
#10 |
Correcto
|
1.09 s | 9 KBi |
#11 |
Correcto
|
1.045 s | 14 KBi |
#12 |
Correcto
|
0.912 s | 14 KBi |
#13 |
Correcto
|
0.97 s | 14 KBi |
#14 |
Correcto
|
1.075 s | 14 KBi |
#15 |
Correcto
|
0.972 s | 14 KBi |
#16 |
Correcto
|
1.019 s | 14 KBi |
#17 |
Correcto
|
0.876 s | 14 KBi |
#18 |
Correcto
|
0.993 s | 16 KBi |
#19 |
Correcto
|
0.974 s | 14 KBi |
#20 |
Correcto
|
1.032 s | 5 KBi |
#21 |
Correcto
|
0.974 s | 14 KBi |
#22 |
Correcto
|
0.993 s | 14 KBi |
#23 |
Correcto
|
1.006 s | 14 KBi |
#24 |
Correcto
|
1.015 s | 15 KBi |
#25 |
Correcto
|
1.023 s | 15 KBi |
#26 |
Correcto
|
1.025 s | 15 KBi |
#27 |
Correcto
|
0.895 s | 15 KBi |
import random def merge(p,q,r): global A n1 = q - p + 1 n2 = r - q L=[] R=[] for i in range(n1): L.append(A[p + i]) for j in range(n2): R.append(A[q + j + 1]) L.append(1000000007) R.append(1000000007) i=0 j=0 for k in range(p,r + 1): if L[i] <= R[j]: A[k] = L[i] i += 1 else: A[k] = R[j] j += 1 def mergeSort(p,r): if p < r: q = int((p + r) / 2) mergeSort(p,q) mergeSort(q+1,r) merge(p,q,r) n = int(input()) A = [int(x) for x in input().split()] #print(A) #if n != 1: mergeSort(0, n - 1) for i in range(len(A)): print(A[i], end = " ")