Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.027 s | 3 KBi |
#2 |
Correcto
|
0.03 s | 4 KBi |
#3 |
Correcto
|
0.025 s | 3 KBi |
#4 |
Correcto
|
0.022 s | 3 KBi |
#5 |
Correcto
|
0.035 s | 3 KBi |
#6 |
Correcto
|
0.025 s | 3 KBi |
#7 |
Correcto
|
0.816 s | 5 KBi |
#8 |
Correcto
|
0.921 s | 8 KBi |
#9 |
Correcto
|
0.97 s | 5 KBi |
#10 |
Correcto
|
0.98 s | 9 KBi |
#11 |
Correcto
|
0.938 s | 14 KBi |
#12 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 35, in <module> mergeSort(0, n - 1) File "script.py", line 28, in mergeSort mergeSort(p,q) File "script.py", line 28, in mergeSort mergeSort(p,q) File "script.py", line 28, in mergeSort mergeSort(p,q) [Previous line repeated 12 more times] File "script.py", line 30, in mergeSort merge(p,q,r) File "script.py", line 18, in merge if L[i] <= R[j]: IndexError: list index out of range |
0.086 s | 14 KBi |
#13 |
Correcto
|
0.979 s | 14 KBi |
#14 |
Correcto
|
1.123 s | 14 KBi |
#15 |
Correcto
|
0.97 s | 14 KBi |
#16 |
Correcto
|
1.008 s | 14 KBi |
#17 |
Correcto
|
1.196 s | 14 KBi |
#18 |
Correcto
|
0.971 s | 15 KBi |
#19 |
Correcto
|
0.986 s | 14 KBi |
#20 |
Correcto
|
0.94 s | 6 KBi |
#21 |
Correcto
|
0.949 s | 14 KBi |
#22 |
Correcto
|
0.887 s | 14 KBi |
#23 |
Correcto
|
1.007 s | 14 KBi |
#24 |
Correcto
|
1.235 s | 15 KBi |
#25 |
Correcto
|
1.029 s | 15 KBi |
#26 |
Correcto
|
0.88 s | 15 KBi |
#27 |
Correcto
|
1.035 s | 16 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(1000000000) R.append(1000000000) 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) mergeSort(0, n - 1) for i in range(len(A)): print(A[i], end = " ")