QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#738865#9621. 连方Aicu123AC ✓6ms3956kbC++202.0kb2024-11-12 20:07:452024-11-12 20:07:45

Judging History

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

  • [2024-11-12 20:07:45]
  • 评测
  • 测评结果:AC
  • 用时:6ms
  • 内存:3956kb
  • [2024-11-12 20:07:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define fi first
#define se second
//cout<<setiosflags(ios::fixed)<<setprecision(K);
const int dx[4]={1,-1,0,0};
const int dy[4]={0,0,1,-1};
const double eps=1e-9; 
const double PI=acos(-1.0);
const int inf=1e9+7;
const int mod=998244353;
const int N=2e5+10,M=N<<1;

void solve(){
    int n=7;
    int m;cin>>m;
    vector<string>s(n+1);
    cin>>s[1]>>s[7];
    string base(m,'.');
    for(int i=2;i<=6;i++) s[i]=base;
    //cerr<<s[1]<<'\n'<<s[7]<<'\n';
    int c1=count(s[1].begin(),s[1].end(),'#');
    int c7=count(s[7].begin(),s[7].end(),'#');
    if(c1==m||c7==m){
        if(c1==0||c7==0||c1==c7){
            cout<<"Yes\n";
            for(int i=2;i<=6;i++) s[i]=s[1];
            for(int i=1;i<=n;i++) cout<<s[i]<<'\n';
        } else {
            cout<<"No\n";
        }
        return;
    }

    cout<<"Yes\n";
    if(s[1][0]=='#'){
        for(int i=0;i<m;i++){
            s[2][i]='#';
            if(s[1][i]=='#') s[2][i]='.';
        }
        s[3]=s[1];
        if(s[1][1]=='#'){
            s[3][0]='.';
        }
    } else {
        for(int i=0;i<m;i++){
            s[2][i]='#';
            if(s[1][i]=='#') s[2][i]='.';
        }
        s[3][0]='#';
        if(s[1][1]=='.'){
            s[2][0]='.';
        }
    }
    s[4][0]='#';
    if(s[7][0]=='#'){
        for(int i=0;i<m;i++){
            s[6][i]='#';
            if(s[7][i]=='#') s[6][i]='.';
        }
        s[5]=s[7];
        if(s[7][1]=='#'){
            s[5][0]='.';
        }
    } else {
        for(int i=0;i<m;i++){
            s[6][i]='#';
            if(s[7][i]=='#') s[6][i]='.';
        }
        s[5][0]='#';
        if(s[7][1]=='.'){
            s[6][0]='.';
        }
    }

    for(int i=1;i<=n;i++){
        cout<<s[i]<<'\n';
    }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int T=1;
    cin>>T;
    while(T--){
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

input:

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

output:

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

result:

ok Correct.

Test #4:

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

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

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

input:

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

output:

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

result:

ok Correct.

Test #7:

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

input:

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

output:

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

result:

ok Correct.