QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#789055#9621. 连方Sword1E1WA 13ms3748kbC++201.6kb2024-11-27 19:10:572024-11-27 19:11:01

Judging History

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

  • [2024-11-27 19:11:01]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:3748kb
  • [2024-11-27 19:10:57]
  • 提交

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.