QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#767908#9621. 连方YFffffffWA 10ms8904kbC++111.5kb2024-11-20 22:39:022024-11-20 22:39:03

Judging History

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

  • [2024-11-20 22:39:03]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:8904kb
  • [2024-11-20 22:39:02]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5 + 10, INF = 1e18, MOD = 1e9 + 7;
typedef pair<int, int> PII;
typedef unsigned long long ull;
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
int arr[N], brr[N];
map<int,int> mp;
map<PII,int> mpp;
vector<PII> vi, g[N];
vector<int> ans;
bool st[N];
int n, m, k;

void solve()
{
	cin >> n;
	string a;
	string b;
	cin >> a >> b;
	string a1 = " " + a + " ";
	string b1 = " " + b + " ";
	if((int)a.find('.') != -1 && (int)b.find('.') != -1){
		string t1 = "", t2 = "", t3 = "" , t4 = "", t5 = "";
		for(int i = 1; i < (int)a1.size() - 1; i ++){
			if(a1[i] == '.' && (a1[i - 1] == '#' || a1[i + 1] == '#')) t1 += '#';
			else{
				t1 += '.';
			}
			if(b1[i] == '.' && (b1[i - 1] == '#' || b1[i + 1] == '#')) t4 += '#';
			else{
				t4 += '.';
			}
		}
		for(int i = 0; i < n; i ++){
			if(t1[i] =='.' && t4[i] == '.' && a[i] != '#') t3 += '#';
			else t3 += '.';
		}
		for(int i = 0; i < n; i ++){
			if(t1[i] == '#' &&  a[i] == '.') t3[i] = '#';
		}
		cout << "YES\n";
		cout << a << "\n" << t1 << "\n" << t1 << "\n" << t3 << "\n" << t4 << "\n" << t4 << "\n" << b << "\n";
		return;
	}else if((int)a.find('.') == -1 && (int)b.find('.') == -1){
		cout << "YES\n";
		for(int i = 0; i < 7; i ++) cout << a << "\n";
		return;
	}
	cout << "NO\n";
}

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.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: 8904kb

input:

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

output:

YES
#..#
.##.
.##.
.##.
#..#
#..#
.##.
YES
##.#.
..#.#
..#.#
..#.#
#.#..
#.#..
.#.##
NO
YES
.######.######.####.#.#####
#......#......#....#.#.....
#......#......#....#.#.....
#......#......#....#.#.....
#....#.#....##.#.....#.....
#....#.#....##.#.....#.....
.####...####..#.......#####
YES
########...

result:

ok Correct.

Test #2:

score: -100
Wrong Answer
time: 10ms
memory: 8604kb

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.