Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cmath>
- using namespace std;
- bool IsSymmetric(vector<vector<int>> a)
- {
- int n,k,i,j;
- n=a.size();
- k=1;
- for (i=0;i<n;++i){
- for (j=0;j<n;++j){
- if (a[i][j]==a[j][i])
- k+=1;
- else{
- k=-112;
- break;}
- }
- if (k<0)
- break;
- }
- return (k>0);
- }
- int main()
- {
- int n,i,j;
- cin >> n;
- vector < vector<int>> a(n, vector<int>(n));
- for(i=0;i<n;++i)
- {
- for(j=0;j<n;++j)
- cin >> a[i][j];
- }
- if (IsSymmetric(a))
- cout<<"yes";
- else
- cout<<"no";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement