Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 1 KBi |
#2 |
Correcto
|
0.002 s | 31 KBi |
#3 |
Correcto
|
0.004 s | 5 KBi |
#4 |
Correcto
|
0.004 s | 1 KBi |
#5 |
Correcto
|
0.004 s | 12 KBi |
#6 |
Correcto
|
0.002 s | 4 KBi |
#7 |
Correcto
|
0.005 s | 1 KBi |
#8 |
Correcto
|
0.004 s | 27 KBi |
#9 |
Correcto
|
0.005 s | 2 KBi |
#10 |
Correcto
|
0.003 s | 26 KBi |
#11 |
Correcto
|
0.003 s | 0 KBi |
#12 |
Correcto
|
0.006 s | 27 KBi |
#13 |
Correcto
|
0.004 s | 2 KBi |
#14 |
Correcto
|
0.004 s | 0 KBi |
#15 |
Correcto
|
0.003 s | 0 KBi |
#16 |
Correcto
|
0.003 s | 14 KBi |
#17 |
Correcto
|
0.005 s | 15 KBi |
#18 |
Correcto
|
0.006 s | 1 KBi |
#19 |
Correcto
|
0.006 s | 2 KBi |
#20 |
Correcto
|
0.006 s | 2 KBi |
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define sz(x) int(x.size()) #define dbg(x) cout << #x << " = " << x << endl int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int val[n][n]; unordered_set<int> st; for (int i = 0; i < n; ++i) { int sum = 0; for (int j = 0; j < n; ++j) { cin >> val[i][j]; sum += val[i][j]; } st.insert(sum); } for (int i = 0; i < n; ++i) { int sum = 0; for (int j = 0; j < n; ++j) { sum += val[i][j]; } st.insert(sum); } int sum = 0; for (int i = 0; i < n; ++i) { sum += val[i][i]; } st.insert(sum); sum = 0; for (int i = 0; i < n; ++i) { sum += val[i][n - i - 1]; } st.insert(sum); if (sz(st) != 1) cout << "No" << endl; else cout << "Yes" << endl; return 0; }