QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#737238#9621. 连方jianglinzhou2003AC ✓7ms2260kbC++141.2kb2024-11-12 15:09:412024-11-12 15:09:43

Judging History

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

  • [2024-11-12 15:09:43]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:2260kb
  • [2024-11-12 15:09:41]
  • 提交

answer

#include<cstdio>
#include<utility>
#define _MAXN 100010
int n,T,L[2]={1,7};
char s[8][_MAXN];
inline char rev(char x) {return '#'+'.'-x;}
bool check()
{
	bool f[2]={1};
	for (int h:{0,1})
		for (int i=1;i<=n;i++)
			if (!(f[h]=(s[L[h]][i]=='#'))) break;
	if (f[0]^f[1]) std::printf("No\n");
		else std::printf("Yes\n");
	if (f[0]&&f[1])
		for (int i=1;i<=7;i++) std::printf("%s\n",s[1]+1);
	return !(f[0]||f[1]);
}
void init()
{
	for (int i=2;i<=6;i++)
	{
		for (int j=1;j<=n;j++) s[i][j]='.';
		s[i][n+1]='\0';
	}
	return;
}
int process(int a,int b,int c)
{
	for (int i=1;i<=n;i++)
		s[b][i]=rev(s[a][i]);
	int xx=0;
	for (int i=1;i<n;i++)
	{
		if (s[b][i]=='#' && s[b][i+1]=='.') {s[c][xx=i+1]='#';break;}
		if (s[b][i]=='.' && s[b][i+1]=='#') {s[c][xx=i]='#';break;}
	}
	return xx;
}
void processmid(int x,int y)
{
	if (x>y) std::swap(x,y);
	if (y<=x+1) s[4][x]='#';
	else for(int i=x+1;i<y;i++) s[4][i]='#';
	return;
}
int main()
{
	std::scanf("%d",&T);
	while (T--)
	{
		std::scanf("%d%s%s",&n,1[s]+1,7[s]+1);
		if (!check()) continue;
		init();
		processmid(process(1,2,3),process(7,6,5));
		for (int i=1;i<=7;i++) std::printf("%s\n",s[i]+1);
	}
	return 0; 
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok Correct.

Test #2:

score: 0
Accepted
time: 3ms
memory: 1640kb

input:

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

output:

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

result:

ok Correct.

Test #3:

score: 0
Accepted
time: 6ms
memory: 1612kb

input:

10000
41
#######.#######.#########################
################.###.#######.############
6
..#..#
#..##.
6
#.#...
#...#.
6
.#.##.
....##
6
...#.#
##..#.
33
#####.###########################
###########.#####################
6
.##.##
.##.#.
5
..##.
####.
17
#.###.##########.
####.##.#####.##.
5
....

output:

Yes
#######.#######.#########################
.......#.......#.........................
......#..................................
.......########..........................
...............#.........................
................#...#.......#............
################.###.#######.############
Ye...

result:

ok Correct.

Test #4:

score: 0
Accepted
time: 7ms
memory: 1560kb

input:

10000
6
..####
.#....
6
...#.#
#..##.
9
..####.##
######..#
33
#######################.#####..##
######.######.###########.#######
6
####.#
#..##.
6
...###
##.###
25
######.#.#.##############
.#########.##########.###
17
############.####
###############.#
6
#..#.#
#####.
6
.#.###
..#...
49
########...

output:

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

result:

ok Correct.

Test #5:

score: 0
Accepted
time: 6ms
memory: 1600kb

input:

10000
5
...#.
#####
6
###...
##..#.
9
.#.######
#.#..####
49
######.##########################################
########.#############.##########################
41
###########.#######.#####################
##############.##########################
6
###..#
###.##
49
#################################...

output:

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

result:

ok Correct.

Test #6:

score: 0
Accepted
time: 2ms
memory: 2220kb

input:

2
100000
###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.#...

output:

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

result:

ok Correct.

Test #7:

score: 0
Accepted
time: 2ms
memory: 2260kb

input:

2
100000
##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##...

output:

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

result:

ok Correct.