QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#748133#9621. 连方xydyyds#AC ✓7ms4300kbC++201.5kb2024-11-14 19:27:212024-11-14 19:27:22

Judging History

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

  • [2024-11-14 19:27:22]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:4300kb
  • [2024-11-14 19:27:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;


void sol() {
    int n; cin>>n;
    string s,t; cin>>s>>t;
    if(count(s.begin(),s.end(),'#')==n) {
        int cnt=count(t.begin(),t.end(),'#');
        // cout<<2333<<" "<<cnt<<endl;
        if(cnt<n) return cout<<"No"<<'\n',void();
        else {
            cout<<"Yes"<<'\n';
            for(int i=0;i<7;i++) 
                cout<<s<<'\n';
            return ;
        }
    } else if(count(t.begin(),t.end(),'#')==n) return cout<<"No"<<'\n',void();

    string s2,t2; 
    
    for(int i=0;i<n;i++) {
        if(s[i]=='.') s2+='#';
        else s2+='.';
    }
    for(int i=0;i<n;i++) {
        if(t[i]=='.') t2+='#';
        else t2+='.';
    }

    int x1; for(int i=0;i+1<n;i++) {
        if(s[i]!=s[i+1]) {
            if(s[i]=='#') x1=i;
            else x1=i+1;
            break;
        }
    }
    int x2; for(int i=0;i+1<n;i++) {
        if(t[i]!=t[i+1]) {
            if(t[i]=='#') x2=i;
            else x2=i+1;
            break;
        }
    }    

    string s3(n,'.'); s3[x1]='#';
    string t3(n,'.'); t3[x2]='#';

    string mid(n,'.');

    if(abs(x1-x2)<=1) mid[x1]='#';
    else for(int i=min(x1+1,x2+1);i<max(x1,x2);i++) mid[i]='#';

    cout<<"Yes"<<'\n';
    cout<<s<<'\n'<<s2<<'\n'<<s3<<'\n';
    cout<<mid<<'\n';
    cout<<t3<<'\n'<<t2<<'\n'<<t<<'\n';
}


int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int T; cin>>T;
    while(T--)
        sol();

    return 0;
}

詳細信息

Test #1:

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

input:

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

output:

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

result:

ok Correct.

Test #2:

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

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

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

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

input:

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

output:

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

result:

ok Correct.

Test #7:

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

input:

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

output:

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

result:

ok Correct.