█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 888

Problema 0xe1 - Cuadrado mágico

  • Autor: abatesins
  • Fecha: 2020-09-27 18:51:33 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.022 s 3 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.022 s 3 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.021 s 3 KBi
#4
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.023 s 3 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.022 s 3 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.021 s 3 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.024 s 3 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.021 s 3 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.022 s 3 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.022 s 3 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.02 s 3 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.023 s 3 KBi
#13
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.032 s 7 KBi
#14
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.024 s 3 KBi
#15
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.023 s 3 KBi
#16
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.021 s 3 KBi
#17
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.022 s 3 KBi
#18
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.024 s 3 KBi
#19
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.024 s 3 KBi
#20
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
0.023 s 3 KBi
Puntos totales: 0 / 100

Código

import numpy as np

if __name__ == '__main__':
  mat_size = int(input())
  mat = [list(map(int, input().split())) for _ 
  in range(mat_size)]
  mat = np.array(mat)

  diag_idx = np.eye(mat_size).astype('bool')
  magic_value = mat[diag_idx].sum()
  is_magic = mat[np.fliplr(diag_idx)].sum() == magic_value
  is_magic = (mat.sum(axis=1) == magic_value).all() * is_magic
  is_magic = (mat.sum(axis=0) == magic_value).all() * is_magic
  print(['No', 'Yes'][int(is_magic)])