Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.01 s | 3 KBi |
#2 |
Correcto
|
0.011 s | 3 KBi |
#3 |
Correcto
|
0.008 s | 3 KBi |
#4 |
Correcto
|
0.011 s | 3 KBi |
#5 |
Correcto
|
0.01 s | 3 KBi |
#6 |
Correcto
|
0.008 s | 3 KBi |
#7 |
Correcto
|
0.014 s | 3 KBi |
#8 |
Correcto
|
0.012 s | 3 KBi |
#9 |
Correcto
|
0.01 s | 3 KBi |
#10 |
Incorrecto
|
0.013 s | 3 KBi |
#11 |
Correcto
|
0.01 s | 3 KBi |
#12 |
Correcto
|
0.011 s | 3 KBi |
#13 |
Correcto
|
0.013 s | 3 KBi |
#14 |
Correcto
|
0.012 s | 3 KBi |
#15 |
Correcto
|
0.009 s | 3 KBi |
#16 |
Correcto
|
0.014 s | 3 KBi |
#17 |
Correcto
|
0.011 s | 3 KBi |
#18 |
Correcto
|
0.01 s | 3 KBi |
#19 |
Correcto
|
0.012 s | 3 KBi |
#20 |
Correcto
|
0.012 s | 3 KBi |
def es_cuadrado_magico(matriz): n = len(matriz) suma_fila = sum(matriz[0]) suma_diagonal1 = sum(matriz[i][i] for i in range(n)) suma_diagonal2 = sum(matriz[i][n - i - 1] for i in range(n)) return suma_diagonal1 == suma_diagonal2 == suma_fila def main(): # Leer el tamaño de la matriz n = int(input()) # Leer la matriz matriz = [list(map(int, input().split())) for _ in range(n)] # Verificar si es un cuadrado mágico es_magico = es_cuadrado_magico(matriz) # Imprimir el resultado print("Yes" if es_magico else "No") if __name__ == "__main__": main()