Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#2 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#3 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#4 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#5 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#6 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#7 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#8 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#9 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#10 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#11 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#12 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#13 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#14 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#15 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#16 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#17 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#18 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#19 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
||
#20 |
Error de compilación
main.c:1:1: error: unknown type name 'import' import time ^ main.c:1:12: error: expected ';' after top level declarator import time ^ ; main.c:46:5: error: invalid preprocessing directive # Use a different sort every minute ^ 3 errors generated. |
import time def bubblesort(arr, num_elements): for i in range(num_elements-1): for ii in range(0, num_elements - i - 1): if (x0 := arr[ii]) > (x1 := arr[ii+1]): arr[ii:ii+2] = x1, x0 return arr def insertionsort(arr, num_elements): for i, x0 in enumerate(arr): for ii, x1 in enumerate(arr[:i]): if x0 < x1: arr[ii+1:i+1] = arr[ii:i] arr[ii] = x0 break return arr def selectionsort(arr, num_elements): for i, x0 in enumerate(arr): x_min, argmin = x0, i for ii, x1 in enumerate(arr[i:], start=i): x_min, argmin = (x_min, argmin) if x1 >= x_min else (x1, ii) arr[i], arr[argmin] = x_min, x0 return arr def mergesort(arr, num_elements): if num_elements > 1: pivot = num_elements // 2 left = mergesort(arr[:pivot], pivot) right = mergesort(arr[pivot:], num_elements - pivot) merged = [] while left and right: lowest = left.pop(0) if left[0] < right[0] else right.pop(0) merged.append(lowest) merged.extend(left) merged.extend(right) return merged else: return arr if __name__ == "__main__": num_elements = int(input()) arr = list(map(int, input().split(' '))) # Use a different sort every minute sorts = [bubblesort, insertionsort, selectionsort, mergesort] sort_idx = int(time.time() / 60) % len(sorts) print(sort_idx) sorted_arr = sorts[sort_idx](arr, num_elements) print(' '.join(map(str, sorted_arr)))