Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.023 s | 3 KBi |
#2 |
Correcto
|
0.024 s | 3 KBi |
#3 |
Correcto
|
0.023 s | 3 KBi |
#4 |
Correcto
|
0.022 s | 3 KBi |
#5 |
Correcto
|
0.022 s | 3 KBi |
#6 |
Correcto
|
0.024 s | 3 KBi |
#7 |
Correcto
|
0.499 s | 6 KBi |
#8 |
Correcto
|
0.611 s | 7 KBi |
#9 |
Correcto
|
0.543 s | 6 KBi |
#10 |
Correcto
|
0.707 s | 9 KBi |
#11 |
Correcto
|
0.485 s | 14 KBi |
#12 |
Correcto
|
0.573 s | 14 KBi |
#13 |
Correcto
|
0.555 s | 14 KBi |
#14 |
Tiempo límite excedido
|
0.494 s | 14 KBi |
#15 |
Correcto
|
0.482 s | 14 KBi |
#16 |
Correcto
|
0.652 s | 14 KBi |
#17 |
Correcto
|
0.728 s | 14 KBi |
#18 |
Tiempo límite excedido
|
0.551 s | 15 KBi |
#19 |
Tiempo límite excedido
|
0.374 s | 14 KBi |
#20 |
Correcto
|
0.54 s | 6 KBi |
#21 |
Correcto
|
0.48 s | 14 KBi |
#22 |
Correcto
|
0.537 s | 14 KBi |
#23 |
Tiempo límite excedido
|
0.523 s | 14 KBi |
#24 |
Correcto
|
0.487 s | 15 KBi |
#25 |
Correcto
|
0.503 s | 15 KBi |
#26 |
Tiempo límite excedido
|
0.528 s | 14 KBi |
#27 |
Correcto
|
0.558 s | 14 KBi |
def merge_sort(list_): size = len(list_) if size > 1: left_list = list_[:(size // 2)] right_list = list_[(size // 2):] merge_sort(left_list) merge_sort(right_list) l = 0 r = 0 i = 0 left_list_size = len(left_list) right_list_size = len(right_list) while l < left_list_size and r < right_list_size: if left_list[l] < right_list[r]: list_[i] = left_list[l] l = l + 1 else: list_[i] = right_list[r] r = r + 1 i = i + 1 while l < left_list_size: list_[i] = left_list[l] l = l + 1 i = i + 1 while r < right_list_size: list_[i] = right_list[r] r = r + 1 i = i + 1 n = int(input()) arr = [int(x) for x in input().split(" ")] merge_sort(arr) for i in arr: print(i, end = " ")