QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#789931#9621. 连方NULL_SFWA 0ms3528kbC++172.3kb2024-11-27 22:54:102024-11-27 22:54:11

Judging History

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

  • [2024-11-27 22:54:11]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3528kb
  • [2024-11-27 22:54:10]
  • 提交

answer

#include <iostream>

using namespace std;

void solve()
{
	int n,k3,k5;
	string s1,s7,s2,s6;
	cin>>n>>s1>>s7;
	
	s2.resize(n);
	s6.resize(n);
	
	//特判全空
	bool f=true;
	for(auto c:s1)
	{
		if(c=='#') f=false;
	}
	if(f)
	{
		cout<<"Yes\n";
		for(int i=1;i<=5;i++){
			for(int j=0;j<n;j++) cout<<'.';
			cout<<'\n';
		}
		for(auto c:s7){
			if(c=='.') cout<<'#';
			else cout<<'.';
		}
		cout<<'\n';
		for(auto c:s7){
			cout<<c;
		}
		cout<<'\n';
		
		return;
	}
	
	f=true;
	for(auto c:s7)
	{
		if(c=='#') f=false;
	}
	if(f)
	{
		cout<<"Yes\n";
		for(auto c:s1){
			cout<<c;
		}
		cout<<'\n';
		for(auto c:s1){
			if(c=='.') cout<<'#';
			else cout<<'.';
		}
		cout<<'\n';
		for(int i=1;i<=5;i++){
			for(int j=0;j<n;j++) cout<<'.';
			cout<<'\n';
		}
		
		return;
	}
	
	int cnt1=0;
	for(auto c:s1)
	{
		cnt1+=c=='.';
	}
	int cnt2=0;
	for(auto c:s2)
	{
		cnt2+=c=='.';
	}
	if(cnt1==0 && cnt2==0)
	{
		cout<<"Yes\n";
		for(int i=1;i<=7;i++){
			for(int j=0;j<n;j++) cout<<'#';
			cout<<'\n';
		}
		return;
	}
	
	for(int i=0;i<n;i++)
	{
		if(s1[i]=='#') s2[i]='.';
		else s2[i]='#';
		
		if(s7[i]=='#') s6[i]='.';
		else s6[i]='#';
	}
	
	bool flag=true;
	for(int i=0;i<n && flag;i++){
		if((s2[i]=='.' && (i==0 || s2[i-1]=='#') && (i==n-1 || s2[i+1]=='#')) || (s2[i]=='#' && (i==0 || s2[i-1]=='.') && (i==n-1 || s2[i+1]=='.')))
		{
			flag=false;
			k3=i;
		}
	}
	if(flag)
	{
		cout<<"No\n";
		return;
	}
	
	flag=true;
	for(int i=0;i<n && flag;i++){
		if((s6[i]=='.' && (i==0 || s6[i-1]=='#') && (i==n-1 || s6[i+1]=='#')) || (s6[i]=='#' && (i==0 || s6[i-1]=='.') && (i==n-1 || s6[i+1]=='.')))
		{
			flag=false;
			k5=i;
		}
	}
	if(flag)
	{
		cout<<"No\n";
		return;
	}
	
	cout<<"Yes\n";
	cout<<s1<<'\n'<<s2<<'\n';
	for(int i=0;i<n;i++){
		if(i==k3) cout<<'#';
		else cout<<'.';
	}
	cout<<'\n';
	for(int i=0;i<n;i++){
		if(i==k3 && k3==k5) cout<<'#';
		else if(i>min(k3,k5) && i<max(k3,k5)) cout<<'#';
		else cout<<'.';
	}
	cout<<'\n';
	for(int i=0;i<n;i++){
		if(i==k5) cout<<'#';
		else cout<<'.';
	}
	cout<<'\n';
	cout<<s6<<'\n'<<s7<<'\n';
	
	return;
}

signed main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	
	int t;
	cin>>t;
	while(t--){
		solve();
	}
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3528kb

input:

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

output:

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

result:

wrong answer Testcase 3: output is YES, but jury's answer is NO.