QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#766992#9621. 连方xiaoyilangWA 0ms3596kbC++981.4kb2024-11-20 19:32:452024-11-20 19:32:48

Judging History

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

  • [2024-11-20 19:32:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2024-11-20 19:32:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
char a[N],b[N],c[N];
int n;
bool judge(){
	int cnt=0;
	for(int i=1;i<=n;i++)	if(c[i]=='#')	cnt++;
	if(cnt==0)	return false;
	for(int i=2;i<=n;i++){
		if(a[i-1]=='#'&&a[i]=='#'&&c[i-1]=='#'&&c[i]=='.')	return false;
		if(b[i-1]=='#'&&b[i]=='#'&&c[i-1]=='#'&&c[i]=='.')	return false;
	}
	return true;
}
void solve(){
	int cnt=0;
	cin>>n;
	cin>>a+1>>b+1;
	for(int i=1;i<=n;i++)
		if(a[i]==b[i])	cnt++;
	if(cnt==0||cnt==n){
		cout<<"Yes\n";
		cout<<a+1<<'\n';
		cout<<a+1<<'\n';
		cout<<a+1<<'\n';
		cout<<a+1<<'\n';
		cout<<b+1<<'\n';
		cout<<b+1<<'\n';
		cout<<b+1<<'\n';
		return ;
	}
	if(a[1]=='.'&&b[1]=='.')	c[1]='#';
	else c[1]='.';
	for(int i=2;i<=n;i++){
		if(a[i]=='.'&&b[i]=='.')	c[i]='#';
		else if(a[i]=='#'&&b[i]=='#')	c[i]='.';
		else{
			if(a[i-1]==b[i-1])	c[i]='.';
			else{
				if(a[i-1]==c[i-1])	c[i]=a[i];
				else c[i]=b[i];
			}
		}
	}
	if(judge()){
		cout<<"Yes\n";
		cout<<a+1<<'\n';
		cout<<a+1<<'\n';
		cout<<a+1<<'\n';
		cout<<c+1<<'\n';
		cout<<b+1<<'\n';
		cout<<b+1<<'\n';
		cout<<b+1<<'\n';
	}
	else cout<<"No\n";
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int T;
	cin>>T;
	while(T--)	solve();
	return 0;
} 
/*
4
4
#..#
.##.
5
##.#.
.#.##
6
######
.####.
27
.######.######.####.#.#####
.####...####..#.......#####

1
10
.##.###.##
##.#####.#
 */

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok Correct.

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3596kb

input:

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

output:

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

result:

wrong answer Testcase 1: Rectangular condition failed.