QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#776511#9621. 连方ucup-team3548#AC ✓7ms4448kbC++202.8kb2024-11-23 19:10:562024-11-23 19:10:56

Judging History

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

  • [2024-11-23 19:10:56]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:4448kb
  • [2024-11-23 19:10:56]
  • 提交

answer

#include<bits/stdc++.h>
#define lf double
using namespace std;
int T;
int N;
char Ans[8][100010];
void Solve()
{
    scanf("%d",&N);
    scanf("%s%s",Ans[1]+1,Ans[7]+1);
    int Cntl=0,Cntr=0;
    for(int i=1;i<=N;++i)
    {
        Cntl+=(Ans[1][i]=='.');
        Cntr+=(Ans[7][i]=='.');
    }
    if(!Cntl||!Cntr)
    {
        if(!Cntl&&!Cntr)
        {
            puts("Yes");
            for(int j=1;j<8;++j)
            {
                for(int i=1;i<=N;++i)
                putchar('#');
                putchar('\n');
            }
        }
        else puts("No");
        return;
    }
    puts("Yes");
    for(int i=1;i<=N;++i)
    {
        Ans[2][i]=(Ans[1][i]=='#'?'.':'#');
        Ans[6][i]=(Ans[7][i]=='#'?'.':'#');
        Ans[4][i]=(i==1?'#':'.');
    }
    if(Ans[1][1]=='#')
    {
        Ans[3][1]='.';
        if(Ans[1][2]=='#')
        {
            for(int i=2;i<=N;++i)
            {
                if(Ans[2][i]=='.')
                Ans[3][i]='#';
                else
                {
                    for(int j=i;j<=N;++j)
                    Ans[3][j]='.';
                    break;
                }
            }
        }
        else
        {
            for(int i=2;i<=N;++i)
            {
                if(Ans[2][i]=='#')
                Ans[3][i]='#';
                else
                {
                    for(int j=i;j<=N;++j)
                    Ans[3][j]='.';
                    break;
                }
            }
        }
    }
    else
    {
        Ans[3][1]='#';
        for(int i=2;i<=N;++i)
        Ans[3][i]='.';
        if(Ans[1][2]=='.')
        Ans[2][1]='.';
    }
    if(Ans[7][1]=='#')
    {
        Ans[5][1]='.';
        if(Ans[7][2]=='#')
        {
            for(int i=2;i<=N;++i)
            {
                if(Ans[6][i]=='.')
                Ans[5][i]='#';
                else
                {
                    for(int j=i;j<=N;++j)
                    Ans[5][j]='.';
                    break;
                }
            }
        }
        else
        {
            for(int i=2;i<=N;++i)
            {
                if(Ans[6][i]=='#')
                Ans[5][i]='#';
                else
                {
                    for(int j=i;j<=N;++j)
                    Ans[5][j]='.';
                    break;
                }
            }
        }
    }
    else
    {
        Ans[5][1]='#';
        for(int i=2;i<=N;++i)
        Ans[5][i]='.';
        if(Ans[7][2]=='.')
        Ans[6][1]='.';
    }
    for(int j=1;j<8;++j)
    {
        for(int i=1;i<=N;++i)
        putchar(Ans[j][i]);
        putchar('\n');
    }
}
int main()
{
    scanf("%d",&T);
    while(T--)
    {
        Solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok Correct.

Test #2:

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

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

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: 3700kb

input:

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

output:

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

result:

ok Correct.

Test #6:

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

input:

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

output:

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

result:

ok Correct.

Test #7:

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

input:

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

output:

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

result:

ok Correct.