Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.034 s | 3 KBi |
#2 |
Correcto
|
0.03 s | 3 KBi |
#3 |
Correcto
|
0.032 s | 3 KBi |
#4 |
Correcto
|
0.024 s | 3 KBi |
#5 |
Correcto
|
0.032 s | 3 KBi |
#6 |
Correcto
|
0.03 s | 3 KBi |
#7 |
Tiempo límite excedido
|
1.094 s | 4 KBi |
#8 |
Tiempo límite excedido
|
1.035 s | 6 KBi |
#9 |
Tiempo límite excedido
|
1.016 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 38, in <module> main() File "script.py", line 32, in main quick_sort(a, left, right) File "script.py", line 5, in quick_sort quick_sort(a, left, start - 1) File "script.py", line 5, in quick_sort quick_sort(a, left, start - 1) File "script.py", line 6, in quick_sort quick_sort(a, start + 1, right) File "script.py", line 5, in quick_sort quick_sort(a, left, start - 1) File "script.py", line 6, in quick_sort quick_sort(a, start + 1, right) File "script.py", line 6, in quick_sort quick_sort(a, start + 1, right) File "script.py", line 6, in quick_sort quick_sort(a, start + 1, right) [Previous line repeated 988 more times] File "script.py", line 4, in quick_sort start = qs_helper(a, left, right) File "script.py", line 13, in qs_helper for i in range(left, right): RecursionError: maximum recursion depth exceeded in comparison |
0.817 s | 8 KBi |
#11 |
Tiempo límite excedido
|
1.068 s | 11 KBi |
#12 |
Tiempo límite excedido
|
1.076 s | 11 KBi |
#13 |
Tiempo límite excedido
|
1.005 s | 11 KBi |
#14 |
Tiempo límite excedido
|
1.082 s | 11 KBi |
#15 |
Tiempo límite excedido
|
1.006 s | 11 KBi |
#16 |
Incorrecto
|
0.693 s | 13 KBi |
#17 |
Incorrecto
|
0.657 s | 13 KBi |
#18 |
Tiempo límite excedido
|
1.032 s | 10 KBi |
#19 |
Tiempo límite excedido
|
1.041 s | 10 KBi |
#20 |
Tiempo límite excedido
|
1.04 s | 4 KBi |
#21 |
Tiempo límite excedido
|
1.063 s | 10 KBi |
#22 |
Tiempo límite excedido
|
1.05 s | 11 KBi |
#23 |
Tiempo límite excedido
|
1.024 s | 11 KBi |
#24 |
Tiempo límite excedido
|
1.015 s | 11 KBi |
#25 |
Tiempo límite excedido
|
1.102 s | 11 KBi |
#26 |
Tiempo límite excedido
|
1.02 s | 11 KBi |
#27 |
Tiempo límite excedido
|
1.071 s | 11 KBi |
def quick_sort(a, left, right): """ Quick sort technique """ 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): """ Helper function """ 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 def main(): """ Using Quick sort """ 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) if __name__ == "__main__": main()