Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.025 s | 3 KBi |
#2 |
Correcto
|
0.023 s | 3 KBi |
#3 |
Correcto
|
0.025 s | 3 KBi |
#4 |
Correcto
|
0.024 s | 3 KBi |
#5 |
Correcto
|
0.022 s | 3 KBi |
#6 |
Correcto
|
0.024 s | 3 KBi |
#7 |
Correcto
|
1.025 s | 5 KBi |
#8 |
Correcto
|
0.952 s | 7 KBi |
#9 |
Correcto
|
0.916 s | 5 KBi |
#10 |
Correcto
|
0.966 s | 10 KBi |
#11 |
Correcto
|
0.929 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.07 s | 14 KBi |
#13 |
Correcto
|
0.974 s | 14 KBi |
#14 |
Correcto
|
0.917 s | 14 KBi |
#15 |
Correcto
|
0.946 s | 14 KBi |
#16 |
Correcto
|
1.05 s | 14 KBi |
#17 |
Correcto
|
1.099 s | 14 KBi |
#18 |
Correcto
|
0.937 s | 14 KBi |
#19 |
Correcto
|
0.94 s | 14 KBi |
#20 |
Correcto
|
0.9 s | 7 KBi |
#21 |
Correcto
|
1.074 s | 14 KBi |
#22 |
Correcto
|
0.946 s | 14 KBi |
#23 |
Correcto
|
0.943 s | 14 KBi |
#24 |
Correcto
|
0.974 s | 15 KBi |
#25 |
Correcto
|
0.912 s | 15 KBi |
#26 |
Correcto
|
0.874 s | 15 KBi |
#27 |
Correcto
|
0.88 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(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 = " ")