QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#809941#9621. 连方Nana7#WA 21ms5752kbC++141.5kb2024-12-11 18:25:462024-12-11 18:25:52

Judging History

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

  • [2024-12-11 18:25:52]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:5752kb
  • [2024-12-11 18:25:46]
  • 提交

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 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]=='#');
	}
	for(int i=1;i<=n;++i) {
		ans[2][i]=1-ans[1][i];
		ans[6][i]=1-ans[7][i];
	}
	bool f1=1,f2=1,c=1;
	for(int i=1;i<=n;++i) {
		if(!ans[1][i]) f1=0;
		if(!ans[7][i]) f2=0; 
		if(ans[1][i]||ans[7][i]) c=0;
	}
	if(c) {
		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<<"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;
	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;
				}
			}
		}
	}
	for(int i=1;i<=7;++i) {
		for(int j=1;j<=n;++j) {
			if(ans[i][j]) putchar('#');
			else putchar('.');
		} putchar('\n');
	}
} 
int main()
{
	int T; cin>>T;
	while(T--) {
		solve();
	}
}

详细

Test #1:

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

input:

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

output:

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

result:

ok Correct.

Test #2:

score: -100
Wrong Answer
time: 21ms
memory: 3940kb

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.