Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.023 s | 3 KBi |
#2 |
Correcto
|
0.029 s | 3 KBi |
#3 |
Correcto
|
0.025 s | 3 KBi |
#4 |
Correcto
|
0.027 s | 3 KBi |
#5 |
Correcto
|
0.022 s | 3 KBi |
#6 |
Correcto
|
0.028 s | 3 KBi |
#7 |
Tiempo límite excedido
|
1.054 s | 4 KBi |
#8 |
Tiempo límite excedido
|
1.029 s | 6 KBi |
#9 |
Tiempo límite excedido
|
1.011 s | 4 KBi |
#10 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Traceback (most recent call last): File "script.py", line 35, in <module> main() File "script.py", line 7, in main quick_sort(a, left, right) File "script.py", line 15, in quick_sort quick_sort(a, left, start -1) File "script.py", line 15, in quick_sort quick_sort(a, left, start -1) File "script.py", line 16, in quick_sort quick_sort(a, start +1, right) File "script.py", line 15, in quick_sort quick_sort(a, left, start -1) File "script.py", line 16, in quick_sort quick_sort(a, start +1, right) File "script.py", line 16, in quick_sort quick_sort(a, start +1, right) File "script.py", line 16, in quick_sort quick_sort(a, start +1, right) [Previous line repeated 988 more times] File "script.py", line 14, in quick_sort start = qs_helper(a, left, right) File "script.py", line 22, in qs_helper for i in range(left, right): RecursionError: maximum recursion depth exceeded in comparison |
0.397 s | 8 KBi |
#11 |
Tiempo límite excedido
|
1.008 s | 11 KBi |
#12 |
Tiempo límite excedido
|
1.02 s | 11 KBi |
#13 |
Tiempo límite excedido
|
1.092 s | 11 KBi |
#14 |
Tiempo límite excedido
|
1.038 s | 11 KBi |
#15 |
Tiempo límite excedido
|
1.083 s | 11 KBi |
#16 |
Tiempo límite excedido
|
1.02 s | 13 KBi |
#17 |
Incorrecto
|
0.951 s | 12 KBi |
#18 |
Tiempo límite excedido
|
1.008 s | 10 KBi |
#19 |
Tiempo límite excedido
|
1.071 s | 10 KBi |
#20 |
Tiempo límite excedido
|
1.045 s | 4 KBi |
#21 |
Tiempo límite excedido
|
1.013 s | 10 KBi |
#22 |
Incorrecto
|
0.989 s | 12 KBi |
#23 |
Tiempo límite excedido
|
1.008 s | 11 KBi |
#24 |
Tiempo límite excedido
|
1.034 s | 11 KBi |
#25 |
Tiempo límite excedido
|
1.041 s | 11 KBi |
#26 |
Tiempo límite excedido
|
1.033 s | 12 KBi |
#27 |
Tiempo límite excedido
|
1.09 s | 11 KBi |
def main(): n = int(input()) integers = input() a = integers.split(" ") left = 0 right = n -1 quick_sort(a, left, right) a = " ".join(str(number) for number in a) print(a) def quick_sort(a, left, right): if left < right: start = qs_helper(a, left, right) quick_sort(a, left, start -1) quick_sort(a, start +1, right) def qs_helper(a, left, right): pivot = a[right] element = left -1 for i in range(left, right): if a[i] < pivot: element = element +1 buffer = a[element] a[element] = a[i] a[i] = buffer buffer = a[element +1] a[element +1] = a[right] a[right] = buffer return element +1 if __name__ == "__main__": main()