fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int n;
  5. cin>>n;
  6. int a[n][n];
  7. for(int i=0; i<n; i++)
  8. for(int j=0; j<n; j++)
  9. cin>>a[i][j];
  10. string ans="YES";
  11. for(int i=0; i<n; i++){
  12. if(a[i][i]!=0) ans="NO";
  13. for(int j=0; j<n; j++)
  14. if(a[i][j]!=a[j][i]) ans="NO";
  15. }
  16. cout<<ans;
  17.  
  18. }
Success #stdin #stdout 0.01s 5280KB
stdin
5
0 0 1 0 0 
0 0 1 0 1 
1 1 0 0 0 
0 0 0 0 0 
0 1 0 0 0 
stdout
YES