Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- #define all(x) x.begin(), x.end()
- #define rall(x) x.rbegin(), x.rend()
- #define endl '\n'
- #define boostIO() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
- ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
- int n;
- typedef vector<vector<char>> matrix;
- matrix v1, v2;
- void rotate(matrix& v) {
- matrix ans = v;
- for (int i = 0; i < n; ++i) {
- for (int j = 0; j < n; ++j) {
- ans[i][j] = v[j][n - i - 1];
- }
- }
- swap(ans, v);
- }
- int main() {
- cin >> n;
- v1.resize(n, vector<char>(n));
- v2.resize(n, vector<char>(n));
- for (auto& row : v1)
- for (auto& x : row)
- cin >> x;
- for (auto& row : v2)
- for (auto& x : row)
- cin >> x;
- bool ok = (v1 == v2);
- for (int i = 0; i < 3; ++i) {
- rotate(v2);
- ok |= (v1 == v2);
- }
- for (auto& row : v2) {
- reverse(all(row));
- }
- ok |= (v1 == v2);
- for (int i = 0; i < 3; ++i) {
- rotate(v2);
- ok |= (v1 == v2);
- }
- cout << (ok ? "YES" : "NO");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement