QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202113#6398. Puzzle: Tapaucup-team870#AC ✓1ms3920kbC++144.9kb2023-10-05 19:29:482023-10-05 19:29:48

Judging History

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

  • [2023-10-05 19:29:48]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3920kb
  • [2023-10-05 19:29:48]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=l; i<=r; i++)
#define per(i,r,l) for(int i=r; i>=l; i--)
#define IOS {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);}
using namespace std;
typedef pair<int,int> P;
P d2(P a,P b){
    return {(a.first+b.first)/2,(a.second+b.second)/2};
}
const int N=200;
int v[N][N],bad[N][N];
char s[N][N];
int f2(int x){return 2*x-1;}
P q[N*N]; int ok[N*N]; P q1[N*10];
int cal(int x,int y){return x*N+y;}
const int M=2505;
vector<int>tu[M];
int nt[N][N];
P pt[M];
P cald(int x){
    return {x/N,x%N};
}

bool vis[M]; int bel[M];
bool dfs(int now){
    for(int son:tu[now]){
        if(!vis[son]){
            vis[son]=1;
            if(!bel[son] || dfs(bel[son])){
                bel[son]=now; return true;
            }
        }
    }
    return false;
}
void ck(int n,int m){
    // cout<<n<<' '<<m<<"hhh\n";
    // rep(i,1,n+m){
    //     cout<<i<<':';
    //     for(auto v:tu[i])cout<<v<<' '; cout<<'\n';
    // }
    if(n!=m){
        cout<<"NO\n";exit(0);
    }
    int ans=0;
    rep(i,1,n){
        memset(vis,0,sizeof vis);
        if(dfs(i)){
            ++ans; //cout<<i<<' '<<bel[i]<<'\n';
        }
    }
    if(ans!=n){
        cout<<"NO\n";exit(0);
    }
    rep(i,n+1,n+m){
        auto [x,y]=d2(pt[i],pt[bel[i]]);
        s[x][y]='.';
    }
}
void wk(int n,int m){
    int lx=3,ly=3,rx=2*n-3,ry=2*m-3;
    auto in1=[&](int x,int y){
        return x>=lx && x<=rx && y>=ly && y<=ry;
    };
    P dir[]={{2,0},{-2,0},{0,2},{0,-2}};
    int cnt=0;
    for(int i=lx;i<=rx;i+=2){
        for(int j=ly;j<=ry;j+=2){
            if(!bad[i][j])continue;
            if((i+j)%4)nt[i][j]=++cnt,pt[cnt]={i,j};
        }
    }
    int nn=cnt;
    for(int i=lx;i<=rx;i+=2){
        for(int j=ly;j<=ry;j+=2){
            if(!bad[i][j])continue;
            if((i+j)%4==0)nt[i][j]=++cnt,pt[cnt]={i,j};
        }
    }
    for(int i=lx;i<=rx;i+=2){
        for(int j=ly;j<=ry;j+=2){
            if(!bad[i][j])continue;
            rep(k,0,3){
                int xx=i+dir[k].first,yy=j+dir[k].second;
                if(in1(xx,yy) && bad[xx][yy])tu[nt[i][j]].push_back(nt[xx][yy]);
            }
        }
    }
    ck(nn,cnt-nn);
}
int main() {
    // IOS
    int n,m; cin>>n>>m;
    rep(i,1,n*2-1)cin>>s[i]+1;
    rep(j,1,m)v[1][f2(j)]=v[f2(n)][f2(j)]=5;
    rep(i,1,n)v[f2(i)][1]=v[f2(i)][f2(m)]=5;
    v[1][1]=3; v[1][f2(m)]=3;
    v[f2(n)][1]=3; v[f2(n)][f2(m)]=3;
    rep(i,1,n){
        rep(j,1,m){
            int x=f2(i),y=f2(j);
            // cout<<x<<' '<<y<<'\n';
            if(v[x][y]){
                if(v[x][y]!=s[x][y]-'0')bad[x][y]=1;
                continue;
            }
            if(s[x][y]!='8'){
                bad[x][y]=1;
            }
        }
    }
    rep(i,1,2*n-1){
        rep(j,1,2*m-1){
            if(s[i][j]=='.')s[i][j]='#';
        }
    }
    wk(n,m);
    int cnt=0;
    rep(i,1,n-1){
        q[++cnt]={f2(i),1}; ok[cnt]=bad[f2(i)][1];
    }
    rep(j,1,m-1){
        q[++cnt]={f2(n),f2(j)}; ok[cnt]=bad[f2(n)][f2(j)];
    }
    per(i,n,2){
        q[++cnt]={f2(i),f2(m)}; ok[cnt]=bad[f2(i)][f2(m)];
    }
    per(j,m,2){
        q[++cnt]={1,f2(j)}; ok[cnt]=bad[1][f2(j)];
    }
    assert(cnt%2==0);
    // rep(i,1,cnt){
    //     cout<<q[i].first<<' '<<q[i].second<<' '<<ok[i]<< '\n';
    // }
    // return 0;
    if(*min_element(ok+1,ok+cnt+1)==1){
        for(int i=1;i<cnt;i+=2){
            int x=q[i].first+q[i+1].first, y=q[i].second+q[i+1].second; x/=2; y/=2;
            s[x][y]='.';
        }
    }
    else{
        vector<P>vec;
        int l=1;
        while(l<=cnt){
            if(!ok[l]){
                ++l; continue;
            }
            int r=l;
            while(r<=cnt && ok[r])++r;
            vec.push_back({l,r-1}); l=r;
        }
        if(ok[1] && ok[cnt]){
            auto [v1,_]=vec.back(); auto [__,v2]=*vec.begin();
            vec.pop_back();
            vec.erase(vec.begin());
            vec.push_back({v1,v2});
        }
        for(auto [l,r]:vec){
            // cout<<l<<' '<<r<<"hhh\n";
            int top=0;
            while(1){
                if(l==r){
                    q1[++top]=q[l];
                    ++l; if(l>cnt)l-=cnt;
                    break;
                }
                q1[++top]=q[l];
                ++l; if(l>cnt)l-=cnt;
            }
            if(top&1){
                cout<<"NO\n"; return 0;
            }
            for(int i=1;i<top;i+=2){
                int x=q1[i].first+q1[i+1].first, y=q1[i].second+q1[i+1].second; x/=2; y/=2;
                s[x][y]='.';
            }
        }
    }
    cout<<"YES\n";
    rep(i,1,2*n-1){
        rep(j,1,2*m-1)cout<<s[i][j]; cout<<'\n';
    }
}
/*
5 5
3.5.5.5.3
.........
5.7.8.7.5
.........
5.7.7.7.5
.........
5.7.7.7.5
.........
3.5.5.5.3

3 3
2.4.3
.....
5.8.5
.....
3.5.3



1 1
3 1
3 1
3 3
5 3
3 3
1 5
1 3
*/

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3580kb

input:

3 3
2.4.3
.....
5.8.5
.....
3.5.3

output:

YES
2.4#3
#####
5#8#5
#####
3#5#3

result:

ok Correct.

Test #2:

score: 0
Accepted
time: 1ms
memory: 3488kb

input:

3 3
3.4.3
.....
5.7.5
.....
3.5.3

output:

NO

result:

ok Correct.

Test #3:

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

input:

2 2
2.2
...
2.2

output:

YES
2#2
.#.
2#2

result:

ok Correct.

Test #4:

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

input:

2 50
2.4.4.4.4.5.5.5.5.5.5.5.5.4.5.5.4.4.5.5.5.5.4.5.5.5.5.5.4.4.5.4.5.5.5.5.5.5.5.5.5.5.5.4.4.5.5.4.5.3
...................................................................................................
2.5.5.4.4.5.5.5.4.4.5.5.5.4.5.5.5.5.5.5.5.5.4.4.4.5.5.5.5.5.5.4.4.4.5.5.5.5.5.5.5.4.4.5.5.5.5.4...

output:

NO

result:

ok Correct.

Test #5:

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

input:

2 50
2.4.4.5.5.5.5.5.5.5.5.5.4.4.5.5.5.5.4.4.5.5.4.4.5.5.5.4.5.4.4.4.5.4.4.5.4.4.5.5.5.5.4.4.5.5.5.5.5.2
...................................................................................................
3.5.4.5.5.5.5.5.5.5.5.5.5.5.4.5.5.5.5.4.5.5.5.5.4.4.5.4.5.4.5.5.5.5.5.4.4.5.5.5.4.4.5.5.5.5.5.4...

output:

NO

result:

ok Correct.

Test #6:

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

input:

50 2
3.2
...
5.4
...
5.5
...
4.4
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.4
...
5.4
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.4
...
5.4
...
5.4
...
5.4
...
4.4
...
5.5
...
5.5
...
4.4
...
5.4
...
5.4
...
5.5
...
4.5
...
4.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
...
5.5
......

output:

NO

result:

ok Correct.

Test #7:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

50 2
3.3
...
5.4
...
5.4
...
5.4
...
5.4
...
5.5
...
4.4
...
4.4
...
5.5
...
4.4
...
5.5
...
5.5
...
5.5
...
5.5
...
4.5
...
5.5
...
5.5
...
5.4
...
5.4
...
5.5
...
5.4
...
5.5
...
5.4
...
5.4
...
5.5
...
5.5
...
4.5
...
4.5
...
4.5
...
4.5
...
5.5
...
5.4
...
5.4
...
5.5
...
5.5
...
4.4
...
4.4
......

output:

NO

result:

ok Correct.

Test #8:

score: 0
Accepted
time: 1ms
memory: 3528kb

input:

3 50
3.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.4.4.5.5.5.5.4.4.5.5.5.5.5.5.5.5.4.4.5.5.4.4.5.4.4.5.3
...................................................................................................
4.8.8.8.8.8.8.8.8.8.8.8.8.8.8.7.7.7.7.7.7.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.7.7.8...

output:

YES
3#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#4.4#5#5#5#5#4.4#5#5#5#5#5#5#5#5#4.4#5#5#4.4#5#4.4#5#3
###################################################################################################
4#8#8#8#8#8#8#8#8#8#8#8#8#8#8#7.7#7.7#7.7#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#7.7#8#...

result:

ok Correct.

Test #9:

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

input:

3 50
2.4.4.4.5.4.4.4.4.4.4.5.5.4.4.5.5.4.4.5.5.5.4.4.5.5.5.4.4.5.5.4.4.4.4.5.5.5.5.5.5.4.4.5.5.5.5.4.4.3
...................................................................................................
5.7.7.8.7.7.7.7.8.8.8.8.7.7.8.7.7.8.8.8.8.7.7.8.8.8.7.7.8.7.7.8.8.8.8.7.7.8.8.7.7.8.8.8.7.7.8.8...

output:

YES
2.4#4.4#5#4.4#4.4#4.4#5#5#4.4#5#5#4.4#5#5#5#4.4#5#5#5#4.4#5#5#4.4#4.4#5#5#5#5#5#5#4.4#5#5#5#5#4.4#3
###################################################################################################
5#7.7#8#7.7#7.7#8#8#8#8#7.7#8#7.7#8#8#8#8#7.7#8#8#8#7.7#8#7.7#8#8#8#8#7.7#8#8#7.7#8#8#8#7.7#8#8#...

result:

ok Correct.

Test #10:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

50 3
3.5.3
.....
5.8.5
.....
5.8.5
.....
5.8.5
.....
5.8.5
.....
5.8.5
.....
5.8.4
.....
5.8.4
.....
4.8.5
.....
4.7.5
.....
5.7.5
.....
5.8.5
.....
5.8.4
.....
5.8.4
.....
5.8.5
.....
5.8.5
.....
5.8.5
.....
5.8.5
.....
5.8.5
.....
4.8.5
.....
4.7.5
.....
5.7.5
.....
5.8.5
.....
5.8.5
.....
5.8.5
....

output:

YES
3#5#3
#####
5#8#5
#####
5#8#5
#####
5#8#5
#####
5#8#5
#####
5#8#5
#####
5#8#4
####.
5#8#4
#####
4#8#5
.####
4#7#5
##.##
5#7#5
#####
5#8#5
#####
5#8#4
####.
5#8#4
#####
5#8#5
#####
5#8#5
#####
5#8#5
#####
5#8#5
#####
5#8#5
#####
4#8#5
.####
4#7#5
##.##
5#7#5
#####
5#8#5
#####
5#8#5
#####
5#8#5
##...

result:

ok Correct.

Test #11:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

50 3
2.4.3
.....
4.8.5
.....
4.8.5
.....
5.8.5
.....
4.7.4
.....
4.7.4
.....
4.8.5
.....
4.8.4
.....
5.8.4
.....
4.7.5
.....
4.7.5
.....
5.8.5
.....
5.8.5
.....
5.8.4
.....
5.8.4
.....
5.8.5
.....
5.8.5
.....
5.7.5
.....
5.7.5
.....
5.8.5
.....
5.8.5
.....
5.8.5
.....
4.8.5
.....
4.7.5
.....
4.7.4
....

output:

YES
2.4#3
#####
4#8#5
.####
4#8#5
#####
5#8#5
#####
4#7#4
.#.#.
4#7#4
#####
4#8#5
.####
4#8#4
####.
5#8#4
#####
4#7#5
.#.##
4#7#5
#####
5#8#5
#####
5#8#5
#####
5#8#4
####.
5#8#4
#####
5#8#5
#####
5#8#5
#####
5#7#5
##.##
5#7#5
#####
5#8#5
#####
5#8#5
#####
5#8#5
#####
4#8#5
.####
4#7#5
##.##
4#7#4
.#...

result:

ok Correct.

Test #12:

score: 0
Accepted
time: 1ms
memory: 3560kb

input:

10 10
2.4.4.4.5.5.4.4.5.2
...................
5.7.8.8.7.8.7.7.8.4
...................
4.7.8.8.7.8.8.8.8.5
...................
4.8.8.8.7.7.8.8.8.4
...................
5.8.7.7.7.7.8.8.7.4
...................
4.7.7.8.8.8.8.8.7.4
...................
4.8.7.8.8.7.7.7.8.4
...................
5.8.7.8.8.7.8....

output:

YES
2.4#4.4#5#5#4.4#5#2
##################.
5#7#8#8#7#8#7.7#8#4
##.#####.##########
4#7#8#8#7#8#8#8#8#5
.##################
4#8#8#8#7#7#8#8#8#4
########.#.#######.
5#8#7.7#7#7#8#8#7#4
################.##
4#7.7#8#8#8#8#8#7#4
.#################.
4#8#7#8#8#7#7.7#8#4
####.#####.########
5#8#7#8#8#7#8#8#...

result:

ok Correct.

Test #13:

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

input:

10 10
3.5.5.5.5.5.5.4.4.3
...................
5.7.7.8.8.7.8.7.7.4
...................
5.8.8.7.7.7.7.7.8.4
...................
5.8.7.7.8.8.8.7.7.5
...................
5.8.8.7.7.7.7.7.7.5
...................
4.7.7.8.8.7.8.8.7.4
...................
4.7.7.7.7.7.7.8.7.4
...................
5.8.7.8.7.7.7....

output:

NO

result:

ok Correct.

Test #14:

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

input:

10 10
2.4.5.4.4.5.5.5.5.3
...................
4.8.7.7.8.8.8.7.8.4
...................
4.8.7.8.7.8.8.7.8.4
...................
5.7.7.8.7.7.7.8.7.5
...................
5.7.8.8.8.8.8.8.7.5
...................
4.7.8.7.7.7.8.8.8.5
...................
4.7.7.7.8.7.7.8.8.5
...................
4.7.8.7.8.8.7....

output:

YES
2.4#5#4.4#5#5#5#5#3
###################
4#8#7.7#8#8#8#7#8#4
.#############.###.
4#8#7#8#7#8#8#7#8#4
####.###.##########
5#7#7#8#7#7.7#8#7#5
##.#############.##
5#7#8#8#8#8#8#8#7#5
###################
4#7#8#7.7#7#8#8#8#5
.#.#######.########
4#7#7.7#8#7#7#8#8#5
############.######
4#7#8#7#8#8#7#8#...

result:

ok Correct.

Test #15:

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

input:

10 10
2.4.4.4.5.5.4.4.5.3
...................
5.7.8.8.7.7.7.7.7.5
...................
5.7.7.7.8.7.7.8.7.5
...................
4.8.7.7.8.8.8.7.8.4
...................
4.8.8.8.7.8.8.7.8.4
...................
4.8.8.8.7.8.8.8.8.5
...................
4.8.7.8.7.7.7.8.8.4
...................
5.8.7.8.7.8.8....

output:

YES
2.4#4.4#5#5#4.4#5#3
###################
5#7#8#8#7.7#7.7#7#5
##.#############.##
5#7#7#7#8#7.7#8#7#5
####.#.############
4#8#7#7#8#8#8#7#8#4
.#############.###.
4#8#8#8#7#8#8#7#8#4
########.##########
4#8#8#8#7#8#8#8#8#5
.##################
4#8#7#8#7#7.7#8#8#4
####.###.#########.
5#8#7#8#7#8#8#8#...

result:

ok Correct.

Test #16:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

10 10
3.5.4.4.5.5.4.4.5.3
...................
5.7.8.8.7.8.8.8.8.5
...................
5.7.8.8.7.7.7.8.8.5
...................
5.8.7.7.8.8.7.8.8.5
...................
5.8.8.8.8.8.7.8.8.4
...................
5.7.7.8.8.7.8.7.8.4
...................
5.7.8.8.8.7.7.7.8.5
...................
5.7.8.8.8.8.7....

output:

YES
3#5#4.4#5#5#4.4#5#3
###################
5#7#8#8#7#8#8#8#8#5
##.#####.##########
5#7#8#8#7#7.7#8#8#5
###################
5#8#7.7#8#8#7#8#8#5
############.######
5#8#8#8#8#8#7#8#8#4
##################.
5#7.7#8#8#7#8#7#8#4
##########.###.####
5#7#8#8#8#7#7#7#8#5
##.#########.######
5#7#8#8#8#8#7#8#...

result:

ok Correct.

Test #17:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

10 10
3.5.5.4.4.5.5.4.4.3
...................
5.7.7.7.7.8.8.7.7.5
...................
5.8.7.7.8.8.8.8.8.5
...................
5.7.8.8.8.7.7.8.8.4
...................
5.7.7.7.8.7.7.8.7.4
...................
5.8.8.8.7.7.8.8.7.5
...................
4.7.7.8.8.8.7.7.8.5
...................
4.8.8.8.7.7.8....

output:

YES
3#5#5#4.4#5#5#4.4#3
###################
5#7.7#7.7#8#8#7.7#5
###################
5#8#7.7#8#8#8#8#8#5
###################
5#7#8#8#8#7#7#8#8#4
##.#######.#.#####.
5#7#7.7#8#7#7#8#7#4
################.##
5#8#8#8#7.7#8#8#7#5
###################
4#7.7#8#8#8#7.7#8#5
.##################
4#8#8#8#7.7#8#7#...

result:

ok Correct.

Test #18:

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

input:

10 10
2.4.4.5.4.4.4.4.4.2
...................
4.8.7.8.8.7.8.8.8.4
...................
4.8.7.8.7.7.7.7.7.4
...................
4.7.7.8.7.8.7.7.7.4
...................
5.8.7.8.7.7.8.8.8.4
...................
4.8.7.8.7.7.7.7.7.5
...................
4.8.7.7.8.8.7.7.7.5
...................
4.7.7.8.8.7.8....

output:

YES
2#4.4#5#4.4#4.4#4.2
.##################
4#8#7#8#8#7#8#8#8#4
####.#####.#######.
4#8#7#8#7#7#7#7#7#4
.#######.###.#.#.##
4#7.7#8#7#8#7#7#7#4
##################.
5#8#7#8#7#7#8#8#8#4
####.###.#.########
4#8#7#8#7#7#7#7#7#5
.###########.#.#.##
4#8#7.7#8#8#7#7#7#5
###################
4#7#7#8#8#7#8#8#...

result:

ok Correct.

Test #19:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

10 10
2.4.4.4.4.4.4.4.4.2
...................
4.8.8.7.7.7.7.8.8.5
...................
4.7.8.7.8.8.7.8.7.4
...................
4.7.8.7.7.8.7.7.7.4
...................
4.8.7.8.7.7.7.7.8.4
...................
4.8.7.8.7.7.7.7.7.4
...................
4.7.8.7.8.7.7.7.7.4
...................
4.7.7.7.7.7.7....

output:

YES
2.4#4.4#4.4#4.4#4.2
###################
4#8#8#7#7.7#7#8#8#5
.#####.#####.######
4#7#8#7#8#8#7#8#7#4
##.#############.#.
4#7#8#7.7#8#7.7#7#4
.##################
4#8#7#8#7#7#7#7#8#4
####.###.#.#.#.###.
4#8#7#8#7#7#7#7#7#4
.###############.##
4#7#8#7#8#7#7#7#7#4
##.###.###.#.#.###.
4#7#7#7#7#7#7#7#...

result:

ok Correct.

Test #20:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

50 50
3.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.3
...................................................................................................
5.8.8.8.8.7.7.8.8.8.8.8.7.7.8.8.8.7.7.7.8.8.8.8.8.8.8.8.8.8.8.7.8.8.8.7.7.8.8.8.8.8.8.8.8.7.8....

output:

YES
3#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#4.4#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#5#3
###################################################################################################
5#8#8#8#8#7.7#8#8#8#8#8#7.7#8#8#8#7#7.7#8#8#8#8#8#8#8#8#8#8#8#7#8#8#8#7.7#8#8#8#8#8#8#8#8#7#8#7....

result:

ok Correct.

Test #21:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

50 50
3.5.5.5.4.4.5.5.5.5.5.5.5.5.5.5.5.5.4.4.5.4.4.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.3
...................................................................................................
4.8.8.8.8.8.8.7.7.8.8.8.8.8.8.8.8.8.7.7.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8....

output:

NO

result:

ok Correct.

Test #22:

score: 0
Accepted
time: 1ms
memory: 3872kb

input:

50 50
3.5.4.4.5.5.5.5.4.4.5.4.4.5.5.4.4.5.5.5.5.5.5.4.4.5.5.5.5.5.5.4.4.5.5.4.4.5.5.5.5.5.5.5.5.5.5.5.5.3
...................................................................................................
5.7.7.8.8.8.7.7.7.8.8.8.8.8.7.8.8.8.8.8.8.8.8.8.8.7.7.8.8.7.7.8.8.8.8.8.8.8.8.8.7.7.8.8.8.8.7....

output:

YES
3#5#4.4#5#5#5#5#4.4#5#4.4#5#5#4.4#5#5#5#5#5#5#4.4#5#5#5#5#5#5#4.4#5#5#4.4#5#5#5#5#5#5#5#5#5#5#5#5#3
###################################################################################################
5#7.7#8#8#8#7#7.7#8#8#8#8#8#7#8#8#8#8#8#8#8#8#8#8#7.7#8#8#7.7#8#8#8#8#8#8#8#8#8#7#7#8#8#8#8#7#8#...

result:

ok Correct.

Test #23:

score: 0
Accepted
time: 1ms
memory: 3832kb

input:

50 50
3.5.4.4.5.4.4.5.5.5.5.5.5.5.5.5.5.4.4.5.5.4.4.4.4.5.5.4.4.5.4.4.5.5.5.4.5.5.5.4.4.5.5.4.4.5.5.5.4.2
...................................................................................................
4.7.8.8.8.7.7.8.7.7.8.8.7.8.8.8.8.7.7.8.8.8.8.8.7.8.8.8.8.8.8.8.8.8.8.8.8.8.7.8.8.8.8.8.7.8.8....

output:

NO

result:

ok Correct.

Test #24:

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

input:

50 50
2.4.5.4.4.5.4.4.5.5.5.4.4.4.4.5.5.5.5.4.4.5.5.5.4.4.5.4.4.5.4.4.5.4.4.5.4.4.5.4.4.5.4.4.5.5.5.5.5.3
...................................................................................................
5.8.8.8.8.7.8.8.8.8.8.8.8.8.7.7.8.8.8.8.8.8.7.7.7.8.8.8.8.7.7.8.8.8.7.8.8.8.7.7.8.8.8.8.7.7.8....

output:

YES
2.4#5#4.4#5#4.4#5#5#5#4.4#4.4#5#5#5#5#4.4#5#5#5#4.4#5#4.4#5#4.4#5#4.4#5#4.4#5#4.4#5#4.4#5#5#5#5#5#3
###################################################################################################
5#8#8#8#8#7#8#8#8#8#8#8#8#8#7.7#8#8#8#8#8#8#7#7.7#8#8#8#8#7.7#8#8#8#7#8#8#8#7.7#8#8#8#8#7.7#8#7....

result:

ok Correct.

Test #25:

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

input:

50 50
2.5.5.5.5.5.5.5.5.5.5.5.4.4.4.4.5.4.4.4.4.4.4.5.5.5.4.4.5.5.4.4.5.5.5.5.5.5.5.5.5.4.4.5.5.5.5.5.5.3
...................................................................................................
4.7.7.7.7.7.8.8.8.8.7.7.8.8.8.8.7.7.8.7.7.8.8.8.7.7.8.7.8.8.8.7.7.8.8.7.7.7.7.7.8.8.7.7.8.8.8....

output:

NO

result:

ok Correct.

Test #26:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

50 50
2.4.4.5.5.5.5.5.5.5.5.5.4.4.5.5.5.4.4.5.5.5.5.5.5.5.5.4.4.5.4.4.5.5.5.5.5.5.4.4.5.4.4.4.4.4.4.5.5.3
...................................................................................................
4.8.7.7.7.7.7.8.7.7.7.7.8.7.7.7.8.7.8.7.7.7.7.8.8.8.8.8.8.8.8.7.7.8.7.8.8.8.8.8.8.8.7.8.8.8.8....

output:

NO

result:

ok Correct.

Test #27:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

50 50
3.5.4.4.4.4.5.4.4.5.4.4.5.5.5.5.5.5.4.4.5.4.4.5.5.5.4.4.5.5.5.4.4.5.5.5.5.5.5.4.4.4.4.4.4.5.5.4.4.3
...................................................................................................
5.8.7.8.8.8.7.7.8.7.7.8.8.8.7.7.8.7.8.8.8.8.7.8.8.8.8.7.7.8.8.7.7.8.7.7.7.7.7.7.8.8.7.7.8.7.7....

output:

NO

result:

ok Correct.

Test #28:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

50 50
3.5.4.4.5.4.4.5.5.5.4.4.5.5.4.4.4.4.4.4.5.5.5.5.4.4.5.5.5.5.4.4.5.5.5.5.4.4.5.4.4.5.5.4.4.5.4.4.5.3
...................................................................................................
4.8.8.8.7.8.7.7.7.7.8.8.8.7.7.8.8.8.7.8.8.8.8.8.8.8.7.7.8.7.8.8.7.7.8.7.7.7.7.8.8.7.8.7.7.7.7....

output:

YES
3#5#4.4#5#4.4#5#5#5#4.4#5#5#4.4#4.4#4.4#5#5#5#5#4.4#5#5#5#5#4.4#5#5#5#5#4.4#5#4.4#5#5#4.4#5#4.4#5#3
###################################################################################################
4#8#8#8#7#8#7#7#7.7#8#8#8#7.7#8#8#8#7#8#8#8#8#8#8#8#7.7#8#7#8#8#7.7#8#7#7#7#7#8#8#7#8#7.7#7.7#7....

result:

ok Correct.

Test #29:

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

input:

50 50
3.5.4.4.4.4.5.5.4.4.4.4.5.4.4.4.4.4.5.4.4.4.4.5.5.4.4.5.5.5.5.4.4.5.5.5.5.5.4.4.5.4.4.4.4.5.5.5.5.3
...................................................................................................
4.8.8.7.7.8.8.8.8.8.8.8.7.7.7.8.8.8.8.7.7.8.8.7.7.7.7.7.7.7.7.8.8.7.7.7.7.7.7.7.7.7.8.7.7.7.8....

output:

NO

result:

ok Correct.

Test #30:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

50 50
2.4.4.5.5.4.4.5.4.4.4.4.5.4.4.4.4.5.5.4.4.5.5.5.5.5.5.4.4.5.4.4.4.4.5.4.4.4.4.4.4.5.4.4.5.5.4.4.5.2
...................................................................................................
4.7.7.7.8.8.8.7.7.7.8.8.8.8.8.8.8.7.7.8.8.8.7.7.7.8.8.7.7.7.7.7.7.7.8.7.7.8.8.8.7.7.8.8.8.7.8....

output:

YES
2#4.4#5#5#4.4#5#4.4#4.4#5#4.4#4.4#5#5#4.4#5#5#5#5#5#5#4.4#5#4.4#4.4#5#4.4#4.4#4.4#5#4.4#5#5#4.4#5#2
.#################################################################################################.
4#7.7#7#8#8#8#7.7#7#8#8#8#8#8#8#8#7.7#8#8#8#7#7.7#8#8#7#7.7#7.7#7.7#8#7.7#8#8#8#7.7#8#8#8#7#8#7....

result:

ok Correct.

Test #31:

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

input:

50 50
3.4.4.5.5.5.5.5.4.4.5.4.4.5.4.4.5.4.4.5.5.5.4.4.4.4.5.4.4.4.4.5.4.4.5.5.4.4.5.4.4.5.5.4.4.5.5.4.4.3
...................................................................................................
5.7.8.7.7.8.7.7.8.7.7.8.7.7.8.7.7.8.7.8.7.8.7.7.7.7.7.7.8.8.8.8.8.7.8.8.8.8.7.7.7.7.8.8.8.7.7....

output:

YES
3#4.4#5#5#5#5#5#4.4#5#4.4#5#4.4#5#4.4#5#5#5#4.4#4.4#5#4.4#4.4#5#4.4#5#5#4.4#5#4.4#5#5#4.4#5#5#4.4#3
###################################################################################################
5#7#8#7.7#8#7.7#8#7#7#8#7#7#8#7#7#8#7#8#7#8#7.7#7#7#7#7#8#8#8#8#8#7#8#8#8#8#7.7#7.7#8#8#8#7.7#8#...

result:

ok Correct.

Test #32:

score: 0
Accepted
time: 1ms
memory: 3876kb

input:

50 50
3.4.4.5.4.4.5.4.4.5.5.5.5.4.4.4.4.5.4.4.5.5.4.4.5.5.4.4.5.5.4.4.4.4.4.4.4.4.5.5.4.4.5.5.5.5.4.4.4.2
...................................................................................................
5.7.7.8.7.7.8.7.7.7.8.7.7.8.8.8.8.8.7.7.7.7.7.7.7.7.7.7.7.7.8.7.8.8.8.8.8.7.7.8.8.7.7.8.8.8.8....

output:

YES
3#4.4#5#4.4#5#4.4#5#5#5#5#4.4#4.4#5#4.4#5#5#4.4#5#5#4.4#5#5#4.4#4.4#4.4#4.4#5#5#4.4#5#5#5#5#4.4#4.2
###################################################################################################
5#7.7#8#7#7#8#7#7.7#8#7.7#8#8#8#8#8#7#7.7#7#7#7#7#7.7#7#7#7#8#7#8#8#8#8#8#7#7#8#8#7.7#8#8#8#8#8#...

result:

ok Correct.

Test #33:

score: 0
Accepted
time: 1ms
memory: 3904kb

input:

50 50
2.4.4.4.4.4.4.5.4.4.4.4.5.4.4.4.4.5.4.4.4.4.5.5.5.4.4.5.4.4.5.4.4.4.4.5.5.4.4.4.4.5.5.5.5.5.4.4.5.3
...................................................................................................
4.8.7.7.8.7.7.7.7.7.8.7.7.7.7.7.8.7.8.7.8.7.7.8.7.8.8.7.7.7.8.8.7.8.7.7.7.7.7.7.7.8.8.7.8.8.8....

output:

YES
2#4.4#4.4#4.4#5#4.4#4.4#5#4.4#4.4#5#4.4#4.4#5#5#5#4.4#5#4.4#5#4.4#4.4#5#5#4.4#4.4#5#5#5#5#5#4.4#5#3
.##################################################################################################
4#8#7.7#8#7.7#7#7#7#8#7#7.7#7#7#8#7#8#7#8#7.7#8#7#8#8#7#7.7#8#8#7#8#7#7#7#7.7#7.7#8#8#7#8#8#8#8#...

result:

ok Correct.

Test #34:

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

input:

50 50
2.4.5.5.4.4.4.4.4.4.5.4.4.5.4.4.5.4.4.5.5.4.4.5.5.4.4.4.4.4.4.5.5.5.5.5.4.4.4.4.5.5.5.4.4.5.5.4.4.3
...................................................................................................
5.8.8.7.7.7.8.7.7.8.8.7.7.8.7.7.7.7.7.7.7.7.8.7.8.7.7.7.7.7.7.8.8.7.7.8.8.7.7.7.7.8.8.8.8.8.8....

output:

YES
2.4#5#5#4.4#4.4#4.4#5#4.4#5#4.4#5#4.4#5#5#4.4#5#5#4.4#4.4#4.4#5#5#5#5#5#4.4#4.4#5#5#5#4.4#5#5#4.4#3
###################################################################################################
5#8#8#7#7.7#8#7.7#8#8#7#7#8#7.7#7#7#7#7.7#7#8#7#8#7#7.7#7#7.7#8#8#7.7#8#8#7#7#7.7#8#8#8#8#8#8#7....

result:

ok Correct.

Test #35:

score: 0
Accepted
time: 1ms
memory: 3888kb

input:

50 50
3.5.5.4.4.4.4.5.4.4.4.4.4.4.4.4.5.4.4.5.4.4.5.4.4.5.4.4.4.4.5.5.4.4.4.4.4.4.5.5.5.5.4.4.5.4.4.4.4.2
...................................................................................................
5.7.8.7.7.7.8.8.8.8.8.7.8.7.7.7.7.8.8.8.7.7.7.7.7.8.7.7.7.7.7.7.7.7.7.8.7.8.7.7.7.7.7.7.7.7.7....

output:

YES
3#5#5#4.4#4.4#5#4.4#4.4#4.4#4.4#5#4.4#5#4.4#5#4.4#5#4.4#4.4#5#5#4.4#4.4#4.4#5#5#5#5#4.4#5#4.4#4.4#2
##################################################################################################.
5#7#8#7.7#7#8#8#8#8#8#7#8#7.7#7#7#8#8#8#7.7#7#7.7#8#7.7#7#7.7#7.7#7#7#8#7#8#7.7#7.7#7.7#7.7#7.7#...

result:

ok Correct.

Test #36:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

50 50
3.4.4.4.4.5.4.4.5.4.4.4.4.5.4.4.4.4.4.4.4.4.4.4.4.4.5.5.4.4.4.4.4.4.5.4.4.4.4.5.4.4.4.4.5.4.4.4.4.3
...................................................................................................
5.7.7.7.7.8.7.7.7.7.7.7.7.7.8.8.8.8.7.7.7.8.7.7.8.8.7.7.7.8.7.7.7.8.7.7.7.7.7.7.8.8.8.7.7.8.7....

output:

NO

result:

ok Correct.

Test #37:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

50 50
2.4.4.4.5.5.4.4.4.4.5.5.4.4.5.5.4.4.4.4.4.4.5.5.5.4.4.5.5.5.5.4.4.4.4.4.4.4.4.4.4.4.4.5.5.5.5.4.4.2
...................................................................................................
5.7.7.7.7.7.7.8.7.7.7.7.7.7.8.7.8.7.7.7.7.7.8.8.8.7.7.8.7.8.8.7.8.7.7.7.8.8.8.7.7.8.8.7.7.8.7....

output:

NO

result:

ok Correct.

Test #38:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

50 50
3.4.4.5.5.4.4.5.5.4.4.5.4.4.4.4.4.4.5.5.4.4.4.4.4.4.5.4.4.5.5.4.4.4.4.4.4.4.4.5.5.5.5.4.4.4.4.4.4.3
...................................................................................................
4.8.7.7.7.7.7.8.8.7.8.7.7.8.8.8.7.7.7.7.8.7.8.7.7.7.7.7.8.7.7.7.7.8.8.8.7.7.8.8.7.8.8.7.7.7.7....

output:

YES
3#4.4#5#5#4.4#5#5#4.4#5#4.4#4.4#4.4#5#5#4.4#4.4#4.4#5#4.4#5#5#4.4#4.4#4.4#4.4#5#5#5#5#4.4#4.4#4.4#3
###################################################################################################
4#8#7#7#7.7#7#8#8#7#8#7#7#8#8#8#7.7#7.7#8#7#8#7.7#7#7.7#8#7#7#7.7#8#8#8#7.7#8#8#7#8#8#7#7.7#7.7#...

result:

ok Correct.

Test #39:

score: 0
Accepted
time: 1ms
memory: 3832kb

input:

50 50
2.4.4.4.4.5.5.4.4.5.5.4.4.4.4.4.4.5.5.4.4.5.4.4.4.4.4.4.4.4.4.4.5.4.4.5.5.5.4.4.4.4.4.4.4.4.5.5.5.2
...................................................................................................
4.8.7.7.8.8.8.7.7.8.7.7.7.7.7.8.7.8.7.7.7.8.7.8.7.8.8.7.7.7.8.7.7.8.7.7.7.7.7.8.7.7.7.8.7.7.8....

output:

YES
2#4.4#4.4#5#5#4.4#5#5#4.4#4.4#4.4#5#5#4.4#5#4.4#4.4#4.4#4.4#4.4#5#4.4#5#5#5#4.4#4.4#4.4#4.4#5#5#5#2
.#################################################################################################.
4#8#7.7#8#8#8#7.7#8#7#7#7.7#7#8#7#8#7.7#7#8#7#8#7#8#8#7#7#7#8#7.7#8#7.7#7#7.7#8#7#7#7#8#7#7#8#7....

result:

ok Correct.

Test #40:

score: 0
Accepted
time: 1ms
memory: 3832kb

input:

50 50
2.5.4.4.4.4.4.4.4.4.4.4.4.4.5.5.4.4.5.5.4.4.4.4.5.4.4.4.4.4.4.5.4.4.4.4.4.4.4.4.4.4.4.4.4.4.5.4.4.2
...................................................................................................
4.7.7.7.7.7.7.7.7.7.8.8.7.8.7.7.7.7.7.8.8.7.7.8.7.8.8.7.7.7.7.7.7.7.7.7.7.7.7.7.8.7.7.8.7.7.8....

output:

YES
2#5#4.4#4.4#4.4#4.4#4.4#4.4#5#5#4.4#5#5#4.4#4.4#5#4.4#4.4#4.4#5#4.4#4.4#4.4#4.4#4.4#4.4#4.4#5#4.4#2
.#################################################################################################.
4#7#7.7#7#7.7#7#7#7#8#8#7#8#7.7#7.7#7#8#8#7.7#8#7#8#8#7#7.7#7#7.7#7#7.7#7.7#7.7#8#7.7#8#7.7#8#7....

result:

ok Correct.

Test #41:

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

input:

50 50
2.4.4.4.4.4.4.4.5.4.4.5.4.4.5.4.4.5.5.4.4.4.4.5.4.4.5.4.4.5.4.4.4.4.5.4.4.4.4.4.4.4.4.4.4.5.4.4.5.3
...................................................................................................
5.7.7.7.7.7.7.7.8.7.7.7.8.7.7.7.8.7.7.8.8.7.8.8.7.7.8.8.7.7.7.8.7.7.7.7.7.7.8.7.7.7.7.7.8.7.7....

output:

YES
2.4#4.4#4.4#4.4#5#4.4#5#4.4#5#4.4#5#5#4.4#4.4#5#4.4#5#4.4#5#4.4#4.4#5#4.4#4.4#4.4#4.4#4.4#5#4.4#5#3
###################################################################################################
5#7.7#7#7#7#7#7#8#7.7#7#8#7.7#7#8#7.7#8#8#7#8#8#7.7#8#8#7#7#7#8#7.7#7#7.7#7#8#7#7.7#7.7#8#7.7#8#...

result:

ok Correct.

Test #42:

score: 0
Accepted
time: 1ms
memory: 3920kb

input:

50 50
2.4.4.4.4.4.5.4.4.4.4.5.4.4.4.4.4.4.4.4.4.4.5.4.4.4.4.5.4.4.5.5.4.4.5.4.4.5.4.4.4.4.5.4.4.4.4.4.4.3
...................................................................................................
4.7.7.7.7.7.7.7.8.7.7.7.7.7.7.7.7.7.8.7.7.8.8.7.8.7.7.8.7.7.8.7.8.7.7.7.7.8.7.7.8.7.7.8.7.8.7....

output:

YES
2.4#4.4#4.4#5#4.4#4.4#5#4.4#4.4#4.4#4.4#4.4#5#4.4#4.4#5#4.4#5#5#4.4#5#4.4#5#4.4#4.4#5#4.4#4.4#4.4#3
###################################################################################################
4#7#7#7.7#7#7#7#8#7.7#7.7#7#7#7#7.7#8#7.7#8#8#7#8#7.7#8#7#7#8#7#8#7.7#7.7#8#7.7#8#7.7#8#7#8#7.7#...

result:

ok Correct.

Test #43:

score: 0
Accepted
time: 1ms
memory: 3900kb

input:

50 50
2.4.4.4.5.4.4.4.4.4.4.5.4.4.5.4.4.4.4.4.4.5.4.4.4.4.5.4.4.4.4.5.4.4.4.4.4.4.4.4.4.4.5.4.4.5.4.4.4.2
...................................................................................................
5.8.7.7.8.8.7.7.8.7.7.8.8.7.7.7.7.7.7.7.7.7.8.7.7.7.7.7.7.7.7.7.7.7.8.7.7.7.7.7.8.7.7.7.7.7.8....

output:

NO

result:

ok Correct.

Test #44:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

37 48
2.4.5.5.4.4.5.5.5.4.4.4.4.4.4.5.4.4.5.5.5.4.4.4.4.5.5.5.4.4.5.5.4.4.5.5.5.5.5.4.4.5.5.5.5.4.4.3
...............................................................................................
5.7.7.7.7.8.8.8.7.7.8.8.8.7.7.7.8.8.7.7.8.7.8.7.8.8.8.8.8.7.8.7.7.8.8.8.7.7.7.8.8.8.7.7.8.8.7.4
.........

output:

YES
2.4#5#5#4.4#5#5#5#4.4#4.4#4.4#5#4.4#5#5#5#4.4#4.4#5#5#5#4.4#5#5#4.4#5#5#5#5#5#4.4#5#5#5#5#4.4#3
###############################################################################################
5#7#7.7#7#8#8#8#7.7#8#8#8#7#7.7#8#8#7.7#8#7#8#7#8#8#8#8#8#7#8#7#7#8#8#8#7#7#7#8#8#8#7.7#8#8#7#4
##.#####...

result:

ok Correct.

Test #45:

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

input:

14 49
3.5.4.4.5.5.5.4.4.5.4.4.5.4.4.5.5.4.4.5.5.5.4.4.4.4.5.4.4.4.4.4.4.5.5.5.4.4.4.4.4.4.5.5.5.5.5.4.2
.................................................................................................
4.8.7.7.7.7.7.7.7.7.8.7.7.8.8.7.7.8.7.7.8.7.8.7.8.7.7.7.7.8.7.8.7.7.7.8.7.7.7.7.8.8.7.7.7.7.8.7.5
...

output:

YES
3#5#4.4#5#5#5#4.4#5#4.4#5#4.4#5#5#4.4#5#5#5#4.4#4.4#5#4.4#4.4#4.4#5#5#5#4.4#4.4#4.4#5#5#5#5#5#4.2
#################################################################################################
4#8#7.7#7.7#7.7#7.7#8#7.7#8#8#7#7#8#7.7#8#7#8#7#8#7.7#7#7#8#7#8#7#7#7#8#7.7#7.7#8#8#7#7#7.7#8#7#5
.#...

result:

ok Correct.

Test #46:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

33 27
2.4.5.4.4.4.4.4.4.5.5.4.4.4.4.4.4.5.4.4.5.5.4.4.4.4.3
.....................................................
5.7.7.7.8.7.7.8.8.8.7.7.8.7.7.7.7.8.7.7.8.7.7.7.7.8.4
.....................................................
4.7.7.7.8.7.7.7.7.8.8.7.7.8.8.8.7.7.8.7.7.8.8.8.8.7.4
...........................

output:

YES
2.4#5#4.4#4.4#4.4#5#5#4.4#4.4#4.4#5#4.4#5#5#4.4#4.4#3
#####################################################
5#7#7#7#8#7#7#8#8#8#7.7#8#7.7#7.7#8#7.7#8#7.7#7.7#8#4
##.#.#.###.#.#######################################.
4#7#7#7#8#7#7#7.7#8#8#7.7#8#8#8#7.7#8#7.7#8#8#8#8#7#4
.#########################...

result:

ok Correct.

Test #47:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

13 26
2.4.5.4.4.4.4.5.4.4.5.5.4.4.5.4.4.5.4.4.5.4.4.4.4.2
...................................................
5.7.7.7.7.8.7.7.7.7.7.7.7.7.7.7.7.7.8.7.7.7.7.7.7.4
...................................................
4.7.7.7.7.7.7.8.7.7.8.8.7.7.7.7.8.7.8.8.8.7.8.7.7.4
.....................................

output:

YES
2.4#5#4.4#4.4#5#4.4#5#5#4.4#5#4.4#5#4.4#5#4.4#4.4#2
##################################################.
5#7.7#7#7#8#7#7.7#7.7#7.7#7.7#7#7.7#8#7.7#7#7.7#7#4
######.#.###.#################.###########.#####.##
4#7#7#7#7#7#7#8#7.7#8#8#7#7#7#7#8#7#8#8#8#7#8#7#7#4
.#.#.#####.#############.#.#.#####.#...

result:

ok Correct.

Test #48:

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

input:

45 7
2.4.5.4.4.5.2
.............
4.7.7.7.7.7.4
.............
4.7.7.7.7.7.5
.............
4.8.8.7.7.7.5
.............
4.7.7.7.7.8.4
.............
4.7.8.7.7.7.4
.............
4.7.8.7.8.7.5
.............
4.7.7.7.7.7.4
.............
4.8.8.7.8.8.4
.............
5.7.7.8.7.7.4
.............
4.7.7.7.7.7.4
....

output:

YES
2.4#5#4.4#5#2
############.
4#7#7#7#7.7#4
.#.#.#.######
4#7#7#7#7#7#5
########.#.##
4#8#8#7#7#7#5
.#####.######
4#7.7#7#7#8#4
########.###.
4#7#8#7#7#7#4
.#.###.###.##
4#7#8#7#8#7#5
#############
4#7.7#7#7.7#4
.#####.#####.
4#8#8#7#8#8#4
#############
5#7.7#8#7.7#4
############.
4#7#7#7.7#7#4
.#...

result:

ok Correct.

Test #49:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

48 36
2.5.5.4.4.4.4.5.4.4.5.5.4.4.5.5.5.5.4.4.4.4.5.5.5.5.5.4.4.4.4.5.5.5.5.3
.......................................................................
4.8.8.7.7.7.8.8.8.8.8.8.7.7.8.8.7.7.7.7.7.8.8.8.8.8.7.7.7.7.7.8.7.8.8.4
.......................................................................
4.8.8....

output:

YES
2#5#5#4.4#4.4#5#4.4#5#5#4.4#5#5#5#5#4.4#4.4#5#5#5#5#5#4.4#4.4#5#5#5#5#3
.######################################################################
4#8#8#7#7.7#8#8#8#8#8#8#7.7#8#8#7.7#7.7#7#8#8#8#8#8#7.7#7#7.7#8#7#8#8#4
######.#################################.###############.#######.#####.
4#8#8#7#...

result:

ok Correct.

Test #50:

score: 0
Accepted
time: 1ms
memory: 3572kb

input:

2 2
3.3
...
3.3

output:

YES
3#3
###
3#3

result:

ok Correct.

Test #51:

score: 0
Accepted
time: 1ms
memory: 3560kb

input:

2 2
2.3
...
2.3

output:

YES
2#3
.##
2#3

result:

ok Correct.

Test #52:

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

input:

2 5
2.4.4.5.2
.........
2.5.4.4.2

output:

YES
2#4.4#5#2
.#######.
2#5#4.4#2

result:

ok Correct.

Test #53:

score: 0
Accepted
time: 1ms
memory: 3560kb

input:

5 2
2.2
...
4.4
...
5.5
...
5.4
...
3.2

output:

YES
2#2
.#.
4#4
###
5#5
###
5#4
##.
3#2

result:

ok Correct.

Test #54:

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

input:

5 2
2.2
...
4.5
...
4.5
...
5.4
...
3.2

output:

YES
2.2
###
4#5
.##
4#5
###
5#4
##.
3#2

result:

ok Correct.