Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error de compilación
Compilation time limit exceeded. |
||
#2 |
Error de compilación
Compilation time limit exceeded. |
||
#3 |
Error de compilación
Compilation time limit exceeded. |
||
#4 |
Error de compilación
Compilation time limit exceeded. |
||
#5 |
Error de compilación
Compilation time limit exceeded. |
||
#6 |
Error de compilación
Compilation time limit exceeded. |
||
#7 |
Error de compilación
Compilation time limit exceeded. |
||
#8 |
Error de compilación
Compilation time limit exceeded. |
||
#9 |
Error de compilación
Compilation time limit exceeded. |
||
#10 |
Correcto
|
0.005 s | 1 KBi |
#11 |
Error de compilación
Compilation time limit exceeded. |
||
#12 |
Error de compilación
Compilation time limit exceeded. |
||
#13 |
Error de compilación
Compilation time limit exceeded. |
||
#14 |
Error de compilación
Compilation time limit exceeded. |
||
#15 |
Error de compilación
Compilation time limit exceeded. |
||
#16 |
Error de compilación
Compilation time limit exceeded. |
||
#17 |
Error de compilación
Compilation time limit exceeded. |
||
#18 |
Correcto
|
0.006 s | 4 KBi |
#19 |
Error de compilación
Compilation time limit exceeded. |
||
#20 |
Correcto
|
0.007 s | 6 KBi |
#include <bits/stdc++.h> #define fi first #define se second #define forn(i,n) for(int i=0; i< (int)n; ++i) #define for1(i,n) for(int i=1; i<= (int)n; ++i) #define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i) #define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i) #define fored(i,l,r) for(int i=(int)r; i>= (int)l; --i) #define pb push_back #define el '\n' #define d(x) cout<< #x<< " " << x<<el #define ri(n) scanf("%d",&n) #define sz(v) ((int)v.size()) #define all(v) v.begin(),v.end() #define allr(v) v.rbegin(),v.rend() using namespace std; typedef long long ll; typedef double ld; typedef pair<int,int> ii; typedef pair<char,int> pci; typedef tuple<int, int, int> tiii; typedef pair<ll,ll> pll; typedef vector<int> vi; const ll inf = 1e18; const int nax = 1e5+200; const double mpi = acos(-1); const double eps= 1e-10; int dr[] = {1,-1,0, 0,1,-1,-1, 1}; // trick to explore an implicit 2D grid int dc[] = {0, 0,1,-1,1, 1,-1,-1}; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout<< setprecision(20)<< fixed; int n; cin>> n; int mat[n][n]; forn(i,n){ forn(j,n){ cin>> mat[i][j]; } } int f = 1e9; forn(i,n){ int sum = 0; forn(j,n){ sum += mat[i][j]; } if(f==1e9 || sum==f) f = sum; else{ cout<< "No"<<el; return 0; } } forn(j,n){ int sum = 0; forn(i,n){ sum += mat[i][j]; } if(sum!=f){ cout<< "No"<<el; return 0; } } int fix = 0; forn(j,2){ int sum = 0; forn(i,n){ sum += mat[i][abs(fix-i)]; } if(sum!=f){ cout<< "No"<<el; return 0; } fix += n-1; } cout<< "Yes"<<el; }