abc 324 D
暴力
abc 323 D
二进制
abc 322 D
暴力
void rotate(auto &s) {
array<string, 4> t;
for (int i = 0; i < 4; i ++)
for (int j = 0; j < 4; j ++)
t[3 - j] += s[i][j];
s = t;
}
#include <bits/stdc++.h>
using namespace std;
void rorate(auto &s) {
array<string, 4> t;
for (int i = 0; i < 4; i ++) {
for (int j = 0; j < 4; j ++) {
t[3 - j] += s[i][j];
}
}
s = t;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
array<array<string, 4>, 3> a;
for (int i = 0; i < 3; i ++)
for (int j = 0; j < 4; j ++)
cin >> a[i][j];
array<string, 4> k;
for (int i = 0; i < 4; i ++) k[i] = "....";
auto dfs = [&](auto self, int u) ->void {
if (u == 3) {
for (int i = 0; i < 4; i ++) {
for (int j = 0; j < 4; j ++) {
if (k[i][j] != '#') return;
}
}
cout << "Yes\n";
exit(0);
}
auto m = a[u];
auto q = k;
for (int i = 0; i < 4; i ++) {
for (int dx = -3; dx <= 3; dx ++) {
for (int dy = -3; dy <= 3; dy ++) {
bool ok = true;
for (int x = 0; x < 4; x ++) {
for (int y = 0; y < 4; y ++) {
int a = x + dx, b = y + dy;
char c = m[x][y];
if (c == '#') {
if (a < 0 || b < 0 || a >= 4 || b >= 4 || k[a][b] == '#') {
ok = false;
break;
}
k[a][b] = '#';
}
}
}
if (ok) self(self, u + 1);
k = q;
}
}
rorate(m);
}
};
dfs(dfs, 0);
cout << "No\n";
return 0;
}