Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.004 s | 1 KBi |
#2 |
Incorrecto
|
0.005 s | 1 KBi |
#3 |
Incorrecto
|
0.004 s | 1 KBi |
#4 |
Incorrecto
|
0.005 s | 4 KBi |
#5 |
Incorrecto
|
0.004 s | 1 KBi |
#6 |
Incorrecto
|
0.004 s | 1 KBi |
#7 |
Incorrecto
|
0.005 s | 1 KBi |
#8 |
Incorrecto
|
0.005 s | 1 KBi |
#9 |
Incorrecto
|
0.004 s | 1 KBi |
#10 |
Incorrecto
|
0.004 s | 1 KBi |
#11 |
Incorrecto
|
0.005 s | 1 KBi |
#12 |
Incorrecto
|
0.005 s | 1 KBi |
#13 |
Incorrecto
|
0.004 s | 1 KBi |
#14 |
Incorrecto
|
0.005 s | 1 KBi |
#15 |
Incorrecto
|
0.005 s | 1 KBi |
#16 |
Incorrecto
|
0.007 s | 1 KBi |
#17 |
Incorrecto
|
0.004 s | 1 KBi |
#18 |
Incorrecto
|
0.007 s | 1 KBi |
#19 |
Incorrecto
|
0.006 s | 1 KBi |
#20 |
Incorrecto
|
0.007 s | 1 KBi |
#include <iostream> using namespace std; int main() { int n; cin >> n; int square[n][n]; int solveRow[n]; int solveColunm[n]; int d1 = 0; int d2 = 0; for(int i=0;i<n;i++) { solveRow[i] = 0; solveColunm[i] = 0; } for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { cin >> square[i][j]; solveRow[i] += square[i][j]; solveColunm[j] += square[i][j]; if(i == j)d1 += square[i][j]; if(i == (n-1-j))d2 += square[i][j]; } } if(d1 != d2) { cout << "NO"; return 0; } bool rows = true; for(int i=0;i<n-1;i++) { rows = rows && solveRow[i] == solveRow[i+1] && solveColunm[i] == solveColunm[i+1]; if(!rows)break; } if(!rows) { cout << "NO"; return 0; } cout << "YES"; return 0; }