QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#736510#9621. 连方ucup-team4352#AC ✓12ms4052kbC++231.7kb2024-11-12 11:28:562024-11-12 11:28:57

Judging History

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

  • [2024-11-12 11:28:57]
  • 评测
  • 测评结果:AC
  • 用时:12ms
  • 内存:4052kb
  • [2024-11-12 11:28:56]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;


void solve(){
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	int flag1=1,flag2=1;
	for(auto u:s){
		if(u=='.'){
			flag1=0;
			break;
		}
	}
	for(auto u:t){
		if(u=='.'){
			flag2=0;
			break;
		}
	}
	if(flag1^flag2){
		cout<<"No\n";
		return;
	}
	if(flag1&flag2){
		cout<<"Yes\n";
		for(int i=1;i<=7;i++){
			for(int j=1;j<=n;j++)cout<<"#";
			cout<<"\n";
		}
		return;
	}
	cout<<"Yes\n";
	cout<<s<<"\n";
	string r;
	int cnt=0;
	for(auto u:s){
		if(u=='.')r+='#';
		else r+='.',cnt++;
	}
	if(cnt==n-1&&s[0]=='.')r=s;
	else{
		if(r[0]=='#'){
			r[0]='.';
		}
	}
	cout<<r<<"\n";
	if(r[1]=='#'){
		cout<<r<<"\n";
	}
	else{
		string t;
		for(auto u:r){
			if(u=='.')t+="#";
			else t+='.';
		}
		t[0]='.';
		cout<<t<<"\n";
		r=t;
	}
	cout<<"#";
	for(int i=2;i<=n;i++)cout<<".";cout<<"\n";
	vector<string>p;
	s=t;
	p.push_back(t);
	r="";
	cnt=0;
	for(auto u:s){
		if(u=='.')r+='#';
		else r+='.',cnt++;
	}
	if(cnt==n-1&&s[0]=='.')r=s;
	else{
		if(r[0]=='#'){
			r[0]='.';
		}
	}
	p.push_back(r);
	if(r[1]=='#'){
		p.push_back(r);
	}
	else{
		string t;
		for(auto u:r){
			if(u=='.')t+="#";
			else t+='.';
		}
		t[0]='.';
		p.push_back(t);
		r=t;
	}
	reverse(p.begin(),p.end());
	for(auto u:p)cout<<u<<"\n";
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0);
	int t=1;
	cin>>t;
	while(t--)solve();
	return 0;
}
/*
4
4
#..#
.##.
5
##.#.
.#.##
6
######
.####.
27
.######.######.####.#.#####
.####...####..#.......#####

.#################

.??????????????????

2 : ..
-> 3 : .#
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3856kb

input:

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

output:

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

result:

ok Correct.

Test #2:

score: 0
Accepted
time: 12ms
memory: 3744kb

input:

10000
6
.#..##
..#...
5
#..#.
##...
6
.###.#
...###
17
.####..#######..#
###########.#####
6
..##.#
#.##.#
25
#.##.##############.####.
####################.##.#
9
##.#..##.
##..#####
6
.###.#
##.###
6
###..#
#.####
25
#####################.#.#
######.##################
6
.#.###
.##..#
6
..####
#......

output:

Yes
.#..##
..##..
.#..##
#.....
.#.###
.#.###
..#...
Yes
#..#.
.##.#
.##.#
#....
.#...
..###
##...
Yes
.###.#
....#.
.###.#
#.....
.##...
.##...
...###
Yes
.####..#######..#
.....##.......##.
.####..#######..#
#................
.##########.#####
...........#.....
###########.#####
Yes
..##.#
.#..#.
...

result:

ok Correct.

Test #3:

score: 0
Accepted
time: 12ms
memory: 3636kb

input:

10000
41
#######.#######.#########################
################.###.#######.############
6
..#..#
#..##.
6
#.#...
#...#.
6
.#.##.
....##
6
...#.#
##..#.
33
#####.###########################
###########.#####################
6
.##.##
.##.#.
5
..##.
####.
17
#.###.##########.
####.##.#####.##.
5
....

output:

Yes
#######.#######.#########################
.......#.......#.........................
.######.#######.#########################
#........................................
.###############.###.#######.############
................#...#.......#............
################.###.#######.############
Ye...

result:

ok Correct.

Test #4:

score: 0
Accepted
time: 8ms
memory: 3740kb

input:

10000
6
..####
.#....
6
...#.#
#..##.
9
..####.##
######..#
33
#######################.#####..##
######.######.###########.#######
6
####.#
#..##.
6
...###
##.###
25
######.#.#.##############
.#########.##########.###
17
############.####
###############.#
6
#..#.#
#####.
6
.#.###
..#...
49
########...

output:

Yes
..####
.#....
.#....
#.....
.#....
..####
.#....
Yes
...#.#
.##.#.
.##.#.
#.....
.##..#
.##..#
#..##.
Yes
..####.##
.#....#..
.#....#..
#........
.#####..#
......##.
######..#
Yes
#######################.#####..##
.......................#.....##..
.######################.#####..##
#................

result:

ok Correct.

Test #5:

score: 0
Accepted
time: 12ms
memory: 3700kb

input:

10000
5
...#.
#####
6
###...
##..#.
9
.#.######
#.#..####
49
######.##########################################
########.#############.##########################
41
###########.#######.#####################
##############.##########################
6
###..#
###.##
49
#################################...

output:

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

result:

ok Correct.

Test #6:

score: 0
Accepted
time: 8ms
memory: 4052kb

input:

2
100000
###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.#...

output:

Yes
###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.##.#.....

result:

ok Correct.

Test #7:

score: 0
Accepted
time: 7ms
memory: 4004kb

input:

2
100000
##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##...

output:

Yes
##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##........

result:

ok Correct.