Advertisement
Georgiy031

Untitled

Nov 1st, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. typedef long long ll;
  5. typedef unsigned long long ull;
  6. #define all(x) x.begin(), x.end()
  7. #define rall(x) x.rbegin(), x.rend()
  8. #define endl '\n'
  9. #define boostIO() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  10. ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
  11.  
  12. int n;
  13. typedef vector<vector<char>> matrix;
  14. matrix v1, v2;
  15.  
  16. void rotate(matrix& v) {
  17.     matrix ans = v;
  18.     for (int i = 0; i < n; ++i) {
  19.         for (int j = 0; j < n; ++j) {
  20.             ans[i][j] = v[j][n - i - 1];
  21.         }
  22.     }
  23.     swap(ans, v);
  24. }
  25.  
  26. int main() {
  27.     cin >> n;
  28.     v1.resize(n, vector<char>(n));
  29.     v2.resize(n, vector<char>(n));
  30.     for (auto& row : v1)
  31.         for (auto& x : row)
  32.             cin >> x;
  33.     for (auto& row : v2)
  34.         for (auto& x : row)
  35.             cin >> x;
  36.     bool ok = (v1 == v2);
  37.     for (int i = 0; i < 3; ++i) {
  38.         rotate(v2);
  39.         ok |= (v1 == v2);
  40.     }
  41.     for (auto& row : v2) {
  42.         reverse(all(row));
  43.     }
  44.     ok |= (v1 == v2);
  45.     for (int i = 0; i < 3; ++i) {
  46.         rotate(v2);
  47.         ok |= (v1 == v2);
  48.     }
  49.     cout << (ok ? "YES" : "NO");
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement