Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.179 s | 14 KBi |
#2 |
Correcto
|
0.128 s | 16 KBi |
#3 |
Correcto
|
0.174 s | 14 KBi |
#4 |
Correcto
|
0.191 s | 21 KBi |
#5 |
Correcto
|
0.139 s | 14 KBi |
#6 |
Correcto
|
0.125 s | 13 KBi |
#7 |
Correcto
|
0.141 s | 14 KBi |
#8 |
Correcto
|
0.128 s | 16 KBi |
#9 |
Correcto
|
0.151 s | 13 KBi |
#10 |
Incorrecto
|
0.12 s | 14 KBi |
#11 |
Correcto
|
0.126 s | 14 KBi |
#12 |
Correcto
|
0.136 s | 20 KBi |
#13 |
Correcto
|
0.131 s | 13 KBi |
#14 |
Correcto
|
0.213 s | 22 KBi |
#15 |
Correcto
|
0.128 s | 15 KBi |
#16 |
Correcto
|
0.39 s | 26 KBi |
#17 |
Correcto
|
0.417 s | 27 KBi |
#18 |
Correcto
|
0.256 s | 24 KBi |
#19 |
Correcto
|
0.433 s | 26 KBi |
#20 |
Correcto
|
0.442 s | 26 KBi |
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[][] numberArray = new int[N][N]; int[] rowSum = new int[N]; int[] columnSum = new int[N]; int diagSum = 0; int diag2Sum = 0; for (int row = 0; row < N; row++) { for (int col = 0; col < N; col++) { numberArray[row][col] = sc.nextInt(); rowSum[row] += numberArray[row][col]; columnSum[col] += numberArray[row][col]; if (row == col) diagSum += numberArray[row][col]; } diag2Sum += numberArray[row][N-1-row]; } sc.close(); System.out.println((Arrays.equals(rowSum, columnSum) && rowSum[0] == diagSum && rowSum[0] == diag2Sum)?"Yes":"No"); } }