QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#789066#9621. 连方Sword1E1WA 1ms3548kbC++201.6kb2024-11-27 19:12:342024-11-27 19:12:41

Judging History

你现在查看的是最新测评结果

  • [2024-11-27 19:12:41]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3548kb
  • [2024-11-27 19:12:34]
  • 提交

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 ans[4][i] = '.'; 
	}
	if (p1 == p2) ans[4][p1] = '#';
	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: 0
Wrong Answer
time: 1ms
memory: 3548kb

input:

5
4
#..#
.##.
5
##.#.
.#.##
6
######
.####.
27
.######.######.####.#.#####
.####...####..#.......#####
10
##########
##########

output:

Yes
#..#
.##.
...#
....
..#.
#..#
.##.
Yes
##.#.
..#.#
...#.
...#.
...#.
#.#..
.#.##
No
Yes
.######.######.####.#.#####
#......#......#....#.#.....
......................#....
......................#....
......................#....
#....###....##.#######.....
.####...####..#.......#####
Yes
########...

result:

wrong answer Testcase 1: Connected condition failed.