Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.015 s | 3 KBi |
#2 |
Correcto
|
0.02 s | 3 KBi |
#3 |
Correcto
|
0.01 s | 3 KBi |
#4 |
Correcto
|
0.016 s | 3 KBi |
#5 |
Correcto
|
0.015 s | 3 KBi |
#6 |
Correcto
|
0.015 s | 3 KBi |
#7 |
Correcto
|
0.008 s | 3 KBi |
#8 |
Correcto
|
0.019 s | 3 KBi |
#9 |
Correcto
|
0.016 s | 3 KBi |
#10 |
Correcto
|
0.016 s | 3 KBi |
#11 |
Correcto
|
0.022 s | 3 KBi |
#12 |
Correcto
|
0.016 s | 3 KBi |
#13 |
Correcto
|
0.015 s | 3 KBi |
#14 |
Correcto
|
0.019 s | 4 KBi |
#15 |
Correcto
|
0.016 s | 3 KBi |
#16 |
Correcto
|
0.018 s | 3 KBi |
#17 |
Correcto
|
0.01 s | 3 KBi |
#18 |
Correcto
|
0.016 s | 3 KBi |
#19 |
Correcto
|
0.019 s | 3 KBi |
#20 |
Correcto
|
0.026 s | 3 KBi |
#Cuadrado mágico def cuadrado_magico(): try: n = int(input()) if n<2 or n>100: raise Exception('Tamano invalido') matriz = [] for i in range(0, n): arreglo=input().split() if n!=len(arreglo): raise Exception('El tamano del arreglo no coincide') arreglo = list(map(lambda x: int(x),arreglo)) matriz.append(arreglo) suma = sum(matriz[i]) diag_principal=0 diag_secundaria=0 for i in range(0, n): diag_secundaria += (matriz[i][n-1-i]) diag_principal += (matriz[i][i]) if(suma!= sum(matriz[i])): return ("No") if(suma!= diag_secundaria or suma!= diag_principal): return ("No") else: return("Yes") except Exception as error: print(error) print(cuadrado_magico())