Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.131 s | 14 KBi |
#2 |
Correcto
|
0.177 s | 14 KBi |
#3 |
Correcto
|
0.15 s | 12 KBi |
#4 |
Correcto
|
0.188 s | 14 KBi |
#5 |
Correcto
|
0.183 s | 20 KBi |
#6 |
Correcto
|
0.12 s | 46 KBi |
#7 |
Correcto
|
0.132 s | 20 KBi |
#8 |
Correcto
|
0.177 s | 14 KBi |
#9 |
Correcto
|
0.134 s | 18 KBi |
#10 |
Incorrecto
|
0.167 s | 15 KBi |
#11 |
Correcto
|
0.126 s | 32 KBi |
#12 |
Correcto
|
0.138 s | 12 KBi |
#13 |
Correcto
|
0.128 s | 25 KBi |
#14 |
Correcto
|
0.177 s | 16 KBi |
#15 |
Correcto
|
0.127 s | 14 KBi |
#16 |
Correcto
|
0.275 s | 30 KBi |
#17 |
Correcto
|
0.259 s | 53 KBi |
#18 |
Correcto
|
0.348 s | 24 KBi |
#19 |
Correcto
|
0.264 s | 24 KBi |
#20 |
Correcto
|
0.39 s | 25 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(); if (Arrays.equals(rowSum, columnSum) && rowSum[0] == diagSum && rowSum[0] == diag2Sum) { System.out.println("Yes"); } else { System.out.println("No"); } } }