QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#789955#9621. 连方NULL_SFWA 9ms3584kbC++172.4kb2024-11-27 23:10:432024-11-27 23:10:45

Judging History

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

  • [2024-11-27 23:10:45]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:3584kb
  • [2024-11-27 23:10:43]
  • 提交

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:s7)
	{
		cnt2+=c=='.';
	}
	if(cnt1==0 || cnt2==0)
	{
		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';
			}
		}
		else
		{
			cout<<"No\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: 100
Accepted
time: 0ms
memory: 3584kb

input:

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

output:

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

result:

ok Correct.

Test #2:

score: -100
Wrong Answer
time: 9ms
memory: 3512kb

input:

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

output:

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

result:

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