Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#2 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#3 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#4 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#5 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#6 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#7 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#8 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#9 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#10 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#11 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#12 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#13 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#14 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#15 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#16 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#17 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#18 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#19 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
||
#20 |
Error de compilación
main.cpp:38:33: error: use of undeclared identifier 'verticalSum' bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; ^ 1 error generated. |
#include <iostream> #include <vector> using namespace std; int main () { int N, n; bool isMagic = true; cin >> N; n = N; vector<vector<int> > matriz(N, vector<int>(N)); while (n--) { for (int i = 0; i < N; i++) { cin >> matriz[n][i]; } } //vertical-horizontal check for (int i = 0; i < N; i++) { int verticalSum = 0, horizontalSum = 0; for (int j = 0; j < N; j++) { horizontalSum += matriz[i][j]; verticalSum += matriz[j][i]; } if (horizontalSum != verticalSum) { isMagic = false; break; } } // diagonal check int diagonal1 = 0, diagonal2 = 0; for (int i = 0, j = N-1; i < N; i++, j--) { diagonal1 += matriz[i][i]; diagonal2 += matriz[i][j]; } bool diagonals = diagonal1 == verticalSum && diagonal1 == diagonal2; if (!isMagic || !diagonals) { cout << "No" << endl; } else { cout << "Yes" << endl; } return 0; }