QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#754771#9621. 连方Icedpiggy#AC ✓7ms4512kbC++141.1kb2024-11-16 15:46:002024-11-16 15:46:00

Judging History

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

  • [2024-11-16 15:46:00]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:4512kb
  • [2024-11-16 15:46:00]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define i64 long long
inline i64 rd()
{
	i64 num=0;char ch=getchar();bool op=0;
	for(;!isdigit(ch);ch=getchar())if(ch=='-')op=1;
	for(;isdigit(ch);ch=getchar())num=num*10+(ch-'0');
	return op?-num:num;
}
const int N=1e5+10;
int n;
inline bool isAll(char *a,char ch)
{
	for(int i=0;i< n;i++)if(a[i]!=ch)return 0;
	return 1;
}
char a[7][N];
inline void print(){printf("Yes\n");for(int i=0;i<=6;i++)a[i][n]=0,printf("%s\n",a[i]);}
inline void work()
{
	n=rd(),scanf("%s%s",a[0],a[6]);
	int type=isAll(a[0],'#')+isAll(a[6],'#');
	for(int i=1;i<=5;i++)for(int j=0;j< n;j++)a[i][j]=".#"[type==2];
	if(type==2)return print();
	if(type==1)return printf("No\n"),void();
	
	int L1=-1,L5=-1;
	for(int i=n-1;i>=1;i--)if(a[0][i]=='.')a[1][i]='#',L1=i;
	for(int i=n-1;i>=1;i--)if(a[6][i]=='.')a[5][i]='#',L5=i;
	if(L1==-1)a[1][0]='#',L1=1;
	if(L5==-1)a[5][0]='#',L5=1;
	a[2][--L1]='#',a[4][--L5]='#';
	if(abs(L1-L5)<=1)a[3][L1]='#';
	else
	{
		if(L1>L5)swap(L1,L5);
		for(int i=L1+1;i<L5;i++)a[3][i]='#';
	}
	print();
}

int main()
{
	for(int test=rd();test;test--)work();
	return 0;
}

详细

Test #1:

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

input:

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

output:

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

result:

ok Correct.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3864kb

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: 7ms
memory: 3888kb

input:

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

output:

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

result:

ok Correct.

Test #4:

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

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: 7ms
memory: 3888kb

input:

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

output:

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

result:

ok Correct.

Test #6:

score: 0
Accepted
time: 4ms
memory: 4512kb

input:

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

output:

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

result:

ok Correct.

Test #7:

score: 0
Accepted
time: 0ms
memory: 4456kb

input:

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

output:

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

result:

ok Correct.