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. }
  14. cout<<ans;
  15.  
  16. }
Success #stdin #stdout 0s 5288KB
stdin
5
1 1 1 1 0 
1 0 1 1 1 
1 1 0 1 1 
1 1 1 1 1 
0 1 1 1 0 
stdout
NO