Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 1 KBi |
#2 |
Correcto
|
0.005 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.003 s | 2 KBi |
#5 |
Correcto
|
0.003 s | 1 KBi |
#6 |
Correcto
|
0.005 s | 1 KBi |
#7 |
Correcto
|
0.005 s | 1 KBi |
#8 |
Correcto
|
0.004 s | 1 KBi |
#9 |
Correcto
|
0.004 s | 1 KBi |
#10 |
Correcto
|
0.004 s | 1 KBi |
#11 |
Correcto
|
0.004 s | 1 KBi |
#12 |
Correcto
|
0.005 s | 2 KBi |
#13 |
Correcto
|
0.004 s | 1 KBi |
#14 |
Correcto
|
0.005 s | 1 KBi |
#15 |
Correcto
|
0.004 s | 1 KBi |
#16 |
Correcto
|
0.006 s | 2 KBi |
#17 |
Correcto
|
0.006 s | 1 KBi |
#18 |
Correcto
|
0.006 s | 1 KBi |
#19 |
Correcto
|
0.005 s | 2 KBi |
#20 |
Correcto
|
0.006 s | 1 KBi |
#include<stdio.h> #include<string.h> int main(){ int n; scanf(" %d",&n); int col[n]; int row[n]; memset(col,0,sizeof(col)); memset(row,0,sizeof(row)); int diag1, diag2; diag1 = diag2 = 0; for(int i = 0; i < n;++i){ for(int j = 0; j < n;++j){ int val; scanf(" %d",&val); if(i == j) diag1 += val; if(i + j == n-1) diag2 += val; col[j] += val; row[i] += val; } } int unique = 1; for(int i = 1; i < n && unique;++i) unique = (col[i] == col[i-1] && row[i] == row[i-1] && row[i] == col[i]); unique = unique & (diag1 == diag2 && diag1 == row[0]); if(unique) puts("Yes"); else puts("No"); return 0; }