fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int p;
  7. cin>>p;
  8. const int n=p;
  9. int a[n][n];
  10. for(int i=0; i<n; i++)
  11. for(int j=0; j<n; j++)
  12. {
  13. cin>>a[i][j];
  14. }
  15. int s=0;
  16. bool f=false;
  17. for(int i=0; i<n; i++)
  18. {
  19. s=0;
  20. for(int j=0; j<n; j++)
  21. {
  22. if(a[i][j]==2) s++;
  23. }
  24. if(s>((n-1)/2)) f=true;
  25. }
  26. if(f)
  27. cout<<"Yes"<<endl;
  28. else
  29. cout<<"No"<<endl;
  30. return 0;
  31. }
Success #stdin #stdout 0s 3344KB
stdin
5
0 2 2 1 1
0 0 1 1 2
0 1 0 2 0
1 1 0 0 1
1 0 2 1 0
stdout
No