QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#789055 | #9621. 连方 | Sword1E1 | WA | 13ms | 3748kb | C++20 | 1.6kb | 2024-11-27 19:10:57 | 2024-11-27 19:11:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
char ans[10][maxn];
void solve() {
int n;cin >> n;
string a,b;cin >> a >> b;
string res = "";
for (int i = 1;i <= n;i++) res += '#';
if (a == res && b == res) {
cout << "Yes" << '\n';
for (int i = 1;i <= 7;i++) cout << a << '\n';
return ;
}
if (a == res || b == res) {
cout << "No" << '\n';
return ;
}
cout << "Yes" << '\n';
for (int i = 0;i < n;i++) ans[1][i] = a[i],ans[7][i] = b[i];
for (int i = 0;i < n;i++) {
if (a[i] == '.') ans[2][i] = '#';
else ans[2][i] = '.';
if (b[i] == '.') ans[6][i] = '#';
else ans[6][i] = '.';
}
int p1 = -1;
for (int i = 0;i < n;i++) {
int l = max(i - 1,0);
int r = min(i + 1,n - 1);
if (ans[2][i] == '.' && (ans[2][l] == '#' || ans[2][r] == '#')) p1 = i;
}
int p2 = -1;
for (int i = 0;i < n;i++) {
int l = max(i - 1,0);
int r = min(i + 1,n - 1);
if (ans[6][i] == '.' && (ans[6][l] == '#' || ans[6][r] == '#')) p2 = i;
}
for (int i = 0;i < n;i++) {
if (i == p1) ans[3][i] = '#';
else ans[3][i] = '.';
}
for (int i = 0;i < n;i++) {
if (i == p2) ans[5][i] = '#';
else ans[5][i] = '.';
}
if (p1 > p2) swap(p1,p2);
for (int i = 0;i < n;i++) {
if (i > p1 && i < p2) ans[4][i] = '#';
else if (i == p1) ans[4][i] = '#';
else ans[4][i] = '.';
}
for (int i = 1;i <= 7;i++) {
for (int j = 0;j < n;j++) cout << ans[i][j];
cout << '\n';
}
}
signed main() {
ios::sync_with_stdio(false);cin.tie(0);
int t = 1;
cin >> t;
while (t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. ...# ..#. ..#. #..# .##. Yes ##.#. ..#.# ...#. ...#. ...#. #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... ......................#.... ......................#.... ......................#.... #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: -100
Wrong Answer
time: 13ms
memory: 3748kb
input:
10000 6 .#..## ..#... 5 #..#. ##... 6 .###.# ...### 17 .####..#######..# ###########.##### 6 ..##.# #.##.# 25 #.##.##############.####. ####################.##.# 9 ##.#..##. ##..##### 6 .###.# ##.### 6 ###..# #.#### 25 #####################.#.# ######.################## 6 .#.### .##..# 6 ..#### #......
output:
Yes .#..## #.##.. ....#. ..##.. ..#... ##.### ..#... Yes #..#. .##.# ...#. .##.. .#... ..### ##... Yes .###.# #...#. .....# ...##. ...#.. ###... ...### Yes .####..#######..# #....##.......##. ................# ............####. ............#.... ...........#..... ###########.##### Yes ..##.# ##..#. ...
result:
wrong answer Testcase 1: Rectangular condition failed.