QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#864441#9621. 连方zty02281128AC ✓14ms3968kbC++172.6kb2025-01-20 16:41:462025-01-20 16:41:46

Judging History

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

  • [2025-01-20 16:41:46]
  • 评测
  • 测评结果:AC
  • 用时:14ms
  • 内存:3968kb
  • [2025-01-20 16:41:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int T,n;
char s[1000005],t[1000005];
int a,b;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
cin>>T;
while(T--){
	cin>>n;a=b=0;
	for(int i=1;i<=n;i++) cin>>s[i];
	for(int i=1;i<=n;i++) cin>>t[i];
	for(int i=1;i<=n;i++){
		if(s[i]=='#') a++;
		if(t[i]=='#') b++;
	} 
	if(a==n&&b==n){
		cout<<"Yes"<<'\n';
		for(int i=1;i<=7;i++){
			for(int j=1;j<=n;j++){
				cout<<'#';
			}
			cout<<'\n';
		}
		continue;
	}
	if(!a&&!b){
		cout<<"Yes"<<'\n';
		for(int i=1;i<=7;i++){
			for(int j=1;j<=n;j++){
				cout<<'.';
			}
			cout<<'\n';
		}
		continue;
	}
	if(a==n||b==n){
		cout<<"No"<<'\n';
		continue;
	}
	if(!a||!b){
		cout<<"Yes"<<'\n';
		for(int i=1;i<=n;i++) cout<<s[i];cout<<'\n';
		for(int i=1;i<=n;i++){
			if(s[i]=='#') cout<<'.';
			else cout<<'#';
		}
		cout<<'\n';
		for(int i=3;i<=5;i++){
			for(int j=1;j<=n;j++) cout<<'.';
			cout<<"\n"; 
		}
		for(int i=1;i<=n;i++){
			if(t[i]=='#') cout<<'.';
			else cout<<'#';
		}
		cout<<'\n';
		for(int i=1;i<=n;i++) cout<<t[i];
		cout<<'\n';
	}
	cout<<"Yes"<<'\n';
	for(int i=1;i<=n;i++) cout<<s[i];cout<<'\n';
	for(int i=1;i<=n;i++){
		if(s[i]=='#') cout<<'.';
		else cout<<'#';
	}
	cout<<'\n';
	int pos1=1,pos2=1;
	if(s[1]=='#') while(s[pos1+1]=='#'&&pos1<n) pos1++;
	else while(s[pos1]!='#') pos1++;
	if(t[1]=='#') while(t[pos2+1]=='#'&&pos2<n) pos2++;
	else while(t[pos2]!='#') pos2++;
	for(int i=1;i<pos1;i++) cout<<'.';
	cout<<'#';
	for(int i=pos1+1;i<=n;i++) cout<<'.';
	cout<<'\n';
	if(pos1<pos2-1){
		for(int i=1;i<=pos1;i++) cout<<'.';
		for(int i=pos1+1;i<pos2;i++) cout<<'#';
		for(int i=pos2;i<=n;i++) cout<<'.';
		cout<<'\n';
	}
	else if(pos1==pos2-1){
		for(int i=1;i<=pos1;i++) cout<<'.';
		cout<<'#';
		for(int i=pos2+1;i<=n;i++) cout<<'.';
		cout<<'\n';
	}
	else if(pos1==pos2){
		for(int i=1;i<pos1;i++) cout<<'.';
		cout<<'#';
		for(int i=pos2+1;i<=n;i++) cout<<'.';
		cout<<'\n';
	}
	else if(pos1==pos2+1){
		for(int i=1;i<=pos2;i++) cout<<'.';
		cout<<'#';
		for(int i=pos1+1;i<=n;i++) cout<<'.';
		cout<<'\n';
	}
	else{
		for(int i=1;i<=pos2;i++) cout<<'.';
		for(int i=pos2+1;i<pos1;i++) cout<<'#';
		for(int i=pos1;i<=n;i++) cout<<'.';
		cout<<'\n';
	}
	for(int i=1;i<pos2;i++) cout<<'.';
	cout<<'#';
	for(int i=pos2+1;i<=n;i++) cout<<'.';
	cout<<'\n';
	for(int i=1;i<=n;i++){
		if(t[i]=='#') cout<<'.';
		else cout<<'#';
	}
	cout<<'\n';
	for(int i=1;i<=n;i++) cout<<t[i];
	cout<<'\n';
}
	return 0;
}
/*
4
4
#..#
.##.
5 
##.#.
.#.##
6
######
.####.
27
.######.######.####.#.#####
.####...####..#.......#####
*/

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3712kb

input:

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

output:

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

result:

ok Correct.

Test #2:

score: 0
Accepted
time: 14ms
memory: 3584kb

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: 13ms
memory: 3712kb

input:

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

output:

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

result:

ok Correct.

Test #4:

score: 0
Accepted
time: 10ms
memory: 3584kb

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: 14ms
memory: 3712kb

input:

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

output:

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

result:

ok Correct.

Test #6:

score: 0
Accepted
time: 14ms
memory: 3968kb

input:

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

output:

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

result:

ok Correct.

Test #7:

score: 0
Accepted
time: 13ms
memory: 3840kb

input:

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

output:

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

result:

ok Correct.