QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#809950#9621. 连方Nana7#WA 12ms5820kbC++141.7kb2024-12-11 18:31:122024-12-11 18:31:17

Judging History

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

  • [2024-12-11 18:31:17]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:5820kb
  • [2024-12-11 18:31:12]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#define I inline
using namespace std;

const int N = 100100;
char up[N],dn[N];
int ans[8][N];
int n;

I void out() {
	for(int i=1;i<=7;++i) {
		for(int j=1;j<=n;++j) {
			if(ans[i][j]) putchar('#');
			else putchar('.');
		} putchar('\n');
	}
}
I void solve() {
	cin>>n;
	scanf("%s",up+1);
	scanf("%s",dn+1);
	for(int i=1;i<=n;++i) 
		for(int j=1;j<=7;++j) ans[j][i]=0;
	for(int i=1;i<=n;++i) {
		ans[1][i]=(up[i]=='#');
		ans[7][i]=(dn[i]=='#');
	}
	bool f1=1,f2=1,c1=1,c2=1;
	for(int i=1;i<=n;++i) {
		if(!ans[1][i]) f1=0;
		if(!ans[7][i]) f2=0; 
		if(ans[1][i]) c1=0;
		if(ans[7][i]) c2=0;
	}
	if(c1&&c2) {
		cout<<"Yes"<<endl;
		out(); return ;
	} else if(c2) {
		cout<<"Yes"<<endl;
		for(int i=1;i<=n;++i) ans[2][i]=1-ans[1][i];
		out();
		return ;
	} else if(c1) {
		cout<<"Yes"<<endl;
		for(int i=1;i<=n;++i) ans[6][i]=1-ans[7][i];
		out();
		return ;
	}
	if(f1&&f2) {
		cout<<"Yes"<<endl;
		for(int i=1;i<=7;++i) {
			for(int j=1;j<=n;++j) putchar('#');
			putchar('\n');
		} 
		return ;
	}
	if(f1||f2) {
		cout<<"No"<<endl;
		return ;
	}
	
	cout<<"Yes"<<endl;
	
	for(int i=1;i<=n;++i) {
		ans[6][i]=1-ans[7][i];
		ans[2][i]=1-ans[1][i];
	}

	
	bool pd=0;
	for(int i=1;i<=n;++i) {
		if(ans[2][i]==ans[6][i]&&!ans[2][i]) {
			pd=1;
			for(int j=3;j<=5;++j) {
				ans[j][i]=1;
			}
		}
	}
	if(!pd) {
		for(int i=1;i<=n;++i) ans[3][i]=ans[1][i];
		for(int i=1;i<=n;++i) {
			if(ans[3][i]==ans[6][i]&&!ans[3][i]) {
				for(int j=4;j<=5;++j) {
					ans[j][i]=1;
				}
			}
		}
	}
	out();
} 
int main()
{
	int T; cin>>T;
	while(T--) {
		solve();
	}
}

詳細信息

Test #1:

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

input:

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

output:

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

result:

ok Correct.

Test #2:

score: -100
Wrong Answer
time: 12ms
memory: 3976kb

input:

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

output:

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

result:

wrong answer Testcase 2: Connected condition failed.