Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.025 s | 3 KBi |
#2 |
Correcto
|
0.021 s | 3 KBi |
#3 |
Correcto
|
0.02 s | 3 KBi |
#4 |
Correcto
|
0.026 s | 3 KBi |
#5 |
Correcto
|
0.02 s | 3 KBi |
#6 |
Correcto
|
0.019 s | 3 KBi |
#7 |
Correcto
|
0.617 s | 12 KBi |
#8 |
Correcto
|
0.692 s | 12 KBi |
#9 |
Correcto
|
0.661 s | 12 KBi |
#10 |
Correcto
|
0.851 s | 13 KBi |
#11 |
Correcto
|
0.61 s | 16 KBi |
#12 |
Correcto
|
0.582 s | 15 KBi |
#13 |
Correcto
|
0.56 s | 15 KBi |
#14 |
Correcto
|
0.607 s | 15 KBi |
#15 |
Correcto
|
0.57 s | 15 KBi |
#16 |
Correcto
|
0.868 s | 16 KBi |
#17 |
Correcto
|
0.847 s | 16 KBi |
#18 |
Correcto
|
0.634 s | 15 KBi |
#19 |
Correcto
|
0.645 s | 16 KBi |
#20 |
Correcto
|
0.805 s | 12 KBi |
#21 |
Correcto
|
0.639 s | 15 KBi |
#22 |
Correcto
|
0.651 s | 15 KBi |
#23 |
Correcto
|
0.603 s | 15 KBi |
#24 |
Correcto
|
0.618 s | 16 KBi |
#25 |
Correcto
|
0.633 s | 16 KBi |
#26 |
Correcto
|
0.678 s | 16 KBi |
#27 |
Correcto
|
0.614 s | 16 KBi |
def mergesort(arr, l, r): if l == r: return [arr[l]] if l > r: return [] m = (l + r) >> 1 res = [] left = mergesort(arr, l, m) right = mergesort(arr, m + 1, r) i = j = 0 while i < len(left) and j < len(right): if left[i] <= right[j]: res.append(left[i]) i += 1 else: res.append(right[j]) j += 1 for x in range(i, len(left)): res.append(left[x]) for x in range(j, len(right)): res.append(right[x]) return res if __name__ == "__main__": N = int(input()) l = list(map(int, input().split(" "))) print(" ".join(map(str, mergesort(l, 0, len(l) - 1))))