Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- void matrix( int n, int m)
- {
- int n1=0, n2=0, res1=0;
- int arr[n][m];
- for (int i=0; i<n; i++)
- for (int j=0; j<m; j++)
- cin >> arr[i][j];
- if (n%2!=0)
- res1 = n*m;
- for (int i=0; i<=n/2; i++)
- for (int j=0; j<m; j++)
- if (arr[i][j]==arr[n-i-1][j])
- n1++;
- //cout << n1 << " ";
- if (n1==res1)
- n1=-1;
- else for (int i=0; i<n; i++)
- for (int j=0; j<=m/2; j++)
- if (arr[i][j]==arr[i][m-j-1])
- n2++;
- //cout << n2 << endl;
- if (n1==res1)
- n2=-1;
- if ( n2==-1 || n1==-1)
- cout << "Yes";
- else cout << "No";
- }
- int main()
- {
- int a=0, b=0;
- cin >> a >> b;
- matrix (a, b);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement