QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#574545#8935. Puzzle: Easy as ScrabblechenhongxuanWA 21ms19516kbC++148.9kb2024-09-18 22:40:242024-09-18 22:40:24

Judging History

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

  • [2024-09-18 22:40:24]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:19516kb
  • [2024-09-18 22:40:24]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define lc p<<1
#define rc p<<1|1
#define pb push_back
#define pii pair<int,int>
#define st first
#define nd second
using namespace std;
inline int read(){
    int x=0,f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar())f^=ch=='-';
    for(;isdigit(ch);ch=getchar())x=x*10+(ch^48);
    return f?x:-x;
}
mt19937 rnd(time(0));
const int mo=998244353;
inline int qpow(int x,int t){
    int ret=1;
    for(;t;t>>=1,x=x*x%mo)if(t&1)ret=ret*x%mo;
    return ret;
}
inline void red(int &x){x>=mo?x-=mo:0;}
inline void chmin(int &x,int y){x=min(x,y);}
inline void chmax(int &x,int y){x=max(x,y);}
const int N=1005;
char str[N][N],ff[N][N];
int n,m,tag[N][N],qd[N][N];
struct oper{
    int x,y,dx,dy;
    char c;
    pii type,ori;
};
vector<oper> op;
pii rev(pii t,int x,int y){
    if(t.st==-1)t.st=x;
    if(t.nd==-1)t.nd=y;
    return t;
}
void output(int t=0){
    for(int i=1;i<=n;++i,puts(""))for(int j=1;j<=m;++j){
        if(!ff[i][j])putchar('.');
        else putchar(ff[i][j]);
    }
    if(t==1){
        for(int i=1;i<=n;++i,puts(""))for(int j=1;j<=m;++j){
            printf("%lld ",qd[i][j]);
        }
    }
    if(t==2){
        for(int i=0;i<=n+1;++i,puts(""))for(int j=0;j<=m+1;++j){
            printf("%lld ",tag[i][j]);
        }
    }
}
int in(int x,int l,int r){return l<=x&&x<=r;}
void work(int i1,int i2,int j1,int j2){
    // printf("This is the :(%lld,%lld,%lld,%lld) work\n",i1,i2,j1,j2);
    if(i1>i2)return;
    if(j1>j2)return;
    op.clear();
    if(!tag[i1][0])op.pb(oper{i1,j1,0,1,str[i1][0],{0,-1},{i1,0}});
    if(!tag[i1][m+1])op.pb(oper{i1,j2,0,-1,str[i1][m+1],{0,-1},{i1,m+1}});
    if(!tag[i2][0])op.pb(oper{i2,j1,0,1,str[i2][0],{n+1,-1},{i2,0}});
    if(!tag[i2][m+1])op.pb(oper{i2,j2,0,-1,str[i2][m+1],{n+1,-1},{i2,m+1}});
    if(!tag[0][j1])op.pb(oper{i1,j1,1,0,str[0][j1],{-1,0},{0,j1}});
    if(!tag[n+1][j1])op.pb(oper{i2,j1,-1,0,str[n+1][j1],{-1,0},{n+1,j1}});
    if(!tag[0][j2])op.pb(oper{i1,j2,1,0,str[0][j2],{-1,m+1},{0,j2}});
    if(!tag[n+1][j2])op.pb(oper{i2,j2,-1,0,str[n+1][j2],{-1,m+1},{n+1,j2}});
    //recheck : so try again
    // if(!tag[i1][0])op.pb(oper{i1,j1,0,1,str[i1][0],{0,-1},{i1,0}});
    // if(!tag[i1][m+1])op.pb(oper{i1,j2,0,-1,str[i1][m+1],{0,-1},{i1,m+1}});
    // if(!tag[i2][0])op.pb(oper{i2,j1,0,1,str[i2][0],{n+1,-1},{i2,0}});
    // if(!tag[i2][m+1])op.pb(oper{i2,j2,0,-1,str[i2][m+1],{n+1,-1},{i2,m+1}});
    // if(!tag[0][j1])op.pb(oper{i1,j1,1,0,str[0][j1],{-1,0},{0,j1}});
    // if(!tag[n+1][j1])op.pb(oper{i2,j1,-1,0,str[n+1][j1],{-1,0},{n+1,j1}});
    // if(!tag[0][j2])op.pb(oper{i1,j2,1,0,str[0][j2],{-1,m+1},{0,j2}});
    // if(!tag[n+1][j2])op.pb(oper{i2,j2,-1,0,str[n+1][j2],{-1,m+1},{n+1,j2}});
    for(oper T:op){
        int exx=0;
        int x=T.x,y=T.y,dx=T.dx,dy=T.dy;
        char c=T.c;
        pii pos=T.type;
        int r=0;
        while(in(x,i1,i2)&&in(y,j1,j2)){
            if(ff[x][y]){
                if(ff[x][y]=='.'){
                    qd[x][y]=-1;
                    x+=dx;
                    y+=dy;
                    continue;
                }
                if(ff[x][y]==c)r=1;
                exx=1;
                break;
            }
            else{
                pii tmp=rev(pos,x,y);
                if(tag[tmp.st][tmp.nd]||str[tmp.st][tmp.nd]==c){
                    ff[x][y]=c;
                    r=1;
                    break;
                }
                qd[x][y]=-1;
                x+=dx;
                y+=dy;
            }
        }
        if(!r){
            if(n==1000&&m==1000)printf("%lld @ %lld %lld\n",exx,T.ori.st,T.ori.nd);
            puts("NO");
            exit(0);
            // output(1);
            return;
        }
    }
    for(oper T:op){
        int x=T.x,y=T.y,dx=T.dx,dy=T.dy;
        char c=T.c;
        pii pos=T.type;
        int r=0;
        while(in(x,i1,i2)&&in(y,j1,j2)){
            if(ff[x][y]){
                if(ff[x][y]=='.'){
                    qd[x][y]=-1;
                    x+=dx;
                    y+=dy;
                    continue;
                }
                if(ff[x][y]==c)r=1;
                break;
            }
            else{
                pii tmp=rev(pos,x,y);
                if(tag[tmp.st][tmp.nd]||str[tmp.st][tmp.nd]==c){
                    ff[x][y]=c;
                    r=1;
                    break;
                }
                qd[x][y]=-1;
                x+=dx;
                y+=dy;
            }
        }
        if(!r){
            if(n==1000&&m==1000)printf("get killed-by correction @ %lld %lld\n",T.ori.st,T.ori.nd);
            puts("NO");
            exit(0);
            // output(1);
            return;
        }
    }
    for(auto T:op){
        tag[T.ori.st][T.ori.nd]=1;
    }
    // puts("First Work");
    // output(1);
    for(int i=i1+1;i<i2;++i){
        if(qd[i][j1]!=-1){
            if(ff[i][j1]){
                tag[i][0]|=(ff[i][j1]==str[i][0]);
            }
            else{
                if(!tag[i][0]){
                    ff[i][j1]=str[i][0];
                    tag[i][0]=1;
                }
            }
        }
    }
    for(int i=i1+1;i<i2;++i){
        if(qd[i][j2]!=-1){
            if(ff[i][j2]){
                tag[i][m+1]|=(ff[i][j2]==str[i][m+1]);
            }
            else{
                if(!tag[i][m+1]){
                    ff[i][j2]=str[i][m+1];
                    tag[i][m+1]=1;
                }
            }
        }
    }
    for(int j=j1+1;j<j2;++j){
        if(qd[i1][j]!=-1){
            if(ff[i1][j]){
                tag[0][j]|=(ff[i1][j]==str[0][j]);
            }
            else{
                if(!tag[0][j]){
                    ff[i1][j]=str[0][j];
                    tag[0][j]=1;
                }
            }
        }
    }
    for(int j=j1+1;j<j2;++j){
        if(qd[i2][j]!=-1){
            if(ff[i2][j]){
                tag[n+1][j]|=(ff[i2][j]==str[n+1][j]);
            }
            else{
                if(!tag[n+1][j]){
                    ff[i2][j]=str[n+1][j];
                    tag[n+1][j]=1;
                }
            }
        }
    }
    // puts("Second work");
    // output(2);
    work(i1+1,i2-1,j1+1,j2-1);
}
void solve(){
    n=read(),m=read();
    for(int i=0;i<=n+1;++i)scanf("%s",str[i]);
    for(int i=1;i<=n;++i){
        if(str[i][0]=='.')tag[i][0]=1;
        if(str[i][m+1]=='.')tag[i][m+1]=1;
    }
    for(int j=1;j<=m;++j){
        if(str[0][j]=='.')tag[0][j]=1;
        if(str[n+1][j]=='.')tag[n+1][j]=1;
    }
    for(int i=1;i<=n;++i)for(int j=1;j<=m;++j){
        if(str[i][j]=='x')ff[i][j]='.';
    }
    work(1,n,1,m);
    for(int t=1;t<=2;++t){
        for(int i=1;i<=n;++i){
            if(!tag[i][0]){
                int r=1;
                for(int j=1;j<=m;++j){
                    if(ff[i][j]!='.'&&ff[i][j]){
                        if(str[i][0]==ff[i][j])r=0;
                        break;
                    }
                }
                if(r)for(int j=1;j<=m;++j){
                    if(!ff[i][j]){ff[i][j]=str[i][0],r=0;break;}
                }
                if(r){puts("NOp");return;}
            }
            if(!tag[i][m+1]){
                int r=1;
                for(int j=m;j>=1;--j){
                    if(ff[i][j]!='.'&&ff[i][j]){
                        if(str[i][m+1]==ff[i][j])r=0;
                        break;
                    }
                }
                if(r)for(int j=m;j>=1;--j){
                    if(!ff[i][j]){ff[i][j]=str[i][m+1],r=0;break;}
                }
                if(r){puts("NOp");return;}
            }
        }
        for(int j=1;j<=m;++j){
            if(!tag[0][j]){
                int r=1;
                for(int i=1;i<=n;++i){
                    if(ff[i][j]!='.'&&ff[i][j]){
                        if(str[0][j]==ff[i][j])r=0;
                        break;
                    }
                }
                if(r)for(int i=1;i<=n;++i){
                    if(!ff[i][j]){ff[i][j]=str[0][j],r=0;break;}
                }
                if(r){puts("NOp");return;}
            }
            if(!tag[n+1][j]){
                int r=1;
                for(int i=n;i>=1;--i){
                    if(ff[i][j]!='.'&&ff[i][j]){
                        if(str[n+1][j]==ff[i][j])r=0;
                        break;
                    }
                }
                if(r)for(int i=n;i>=1;--i){
                    if(!ff[i][j]){ff[i][j]=str[n+1][j],r=0;break;}
                }
                if(r){puts("NOp");return;}
            }
        }
    }
    puts("YES");
    for(int i=1;i<=n;++i,puts(""))for(int j=1;j<=m;++j){
        if(!ff[i][j])putchar('.');
        else putchar(ff[i][j]);
    }
    return;
}
signed main(){
    // freopen("D.out","w",stdout);
    for(int cas=1;cas--;)solve();
    return 0;
}

詳細信息

Test #1:

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

input:

5 5
.CBA...
....x..
..x...C
A.....B
B..x..A
C......
.......

output:

YES
CBA..
....C
A...B
B...A
C....

result:

ok Correct.

Test #2:

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

input:

1 2
....
Nx..
..O.

output:

NO

result:

ok Correct.

Test #3:

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

input:

5 5
.U.N.X.
U....xX
Ox....X
M...xxN
Vx....S
Ix.x..X
..IBHX.

output:

YES
U.NX.
.O..X
M.N..
.VB.S
.I.HX

result:

ok Correct.

Test #4:

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

input:

10 10
.BAZEMIEKUJ.
A..........K
B..x.x.x..x.
K.........xT
A.x..x.....J
Hx....x....B
Q..x....x.xW
S...x......W
S...x.xxx..Z
...x......xZ
I..x..x.x.xR
.QKO.ID..RW.

output:

YES
.AZEMIEK..
B.......U.
K.......T.
A........J
.H.......B
Q.......W.
S........W
S.O.....Z.
QK...D..Z.
...II...R.

result:

ok Correct.

Test #5:

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

input:

5 10
.PTWIVVISPY.
T...x.x....Y
Xx.x.xx..x.K
P.x.xx.....K
S..........A
E.........xS
.SPEASDCYSA.

output:

YES
.TW.V.ISPY
.X.I.....K
P....V...K
SP.......A
..EASDCYS.

result:

ok Correct.

Test #6:

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

input:

10 5
.HVYN..
Y.x...C
V..x..B
H...x.Z
....xxN
....x.P
B.x...G
Fx.x..D
Txx..xK
E..x.xR
Sx....B
.EPSBD.

output:

YES
..YNC
.V..B
H...Z
..N..
....P
B...G
.F..D
..TK.
EP.R.
..SB.

result:

ok Correct.

Test #7:

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

input:

50 50
.YDOGQIDENEUMONVSGZNMNHLEZCXIRMK.OOCKJOKXXZDUFEMPXS.
Y.x...x.x.x..x..........x.......x......x.....x....xX
N.........x.....x.....x....x.x.xxxxx.x...x.........E
U.....x.....x....x......x.....x........x..........xS
...x......x........x..x.....x.x.x........x.x.x.....S
Q.....x.x..x..........x....x....

output:

YES
Y.OGQ.D.N.UM.NVSGZNMNHL.ZCXIRMK.OOCKJO.XXZDU.EMPX.
ND...I.E....O..........E..............K.....F...E.
U........E......................................S.
.................................................S
Q................................................L
F...........................................

result:

ok Correct.

Test #8:

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

input:

100 100
.NUXAMX.LNWZKRRKZIRNZVDJF.XRB.VEFQXHTGLGIKZYSRPPF.YGVTOSQCADEG.KYKH.NWWO.XDXJW.G.RBHABFLWHFVUNOLBHMKN.
U..x...x...x....xx........x.....x.....xxx..x..........x..x...x..xx..x..x..x............x.....x.....x.N
C...x.......x.............x....x.x.x..x........x..x.xx..x..xx.................x..........

output:

YES
.U.AMX.LNW.KRRK..RNZVDJF..RB.VE.QXHTG...KZ.SRPPF.YGVT.SQ.ADE..K..H..WW..X.XJW.G.RBHABF.WHFVU.OLBHM.N
.CX.......Z....ZI..............F......GI..Y..........O..C...G..YK..N..O..D..................N.....KO
.O...................................L...........................................................

result:

ok Correct.

Test #9:

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

input:

500 500
..FHFDLGFGHREQBGILNRAGJ.ERZSAFGLQ.ESEBI.ELKM.RENLNFQSPT.TXUEIKHHOQWABSELMOPGTFGTXGYMTSU.N.O.AX.OGNSWTFSLUIMTUX.RUCECKZCXOJNPTFVAJUJTF.LHXURYIQIJCVWDBVZ.ZXFRAT.XIPXTDCSLHJHSZCW.RMNUGPIHYUQYUYAY.NHCBU.JPMLG.DDXAJWKNZJVKNAWAJZAHW.FCBEVATZ.YZ.HQ..QPLFARSHNP..EDPIKLYLF.FIFXEXR.XSUORAP.CZPMJXPUS.W...

output:

YES
...FDL...HREQ..ILNRA...ERZSA.GL...SE.I..LK...ENLNFQS.T.TX.E.K.HOQWA.SE.M.PGTFG.XGY..SU...O.AX.OGNS.TFSLUIM.UX...CEC..CXOJNPT.VA..JTF.LHXURYIQI.CVWDB.Z..XFR.T..IPXTD..LHJHSZCW.RMNUGPIHYUQY.YA..N.CB..JPM.G.DD.AJW.NZJ...AWAJZAHW.FCB...T..YZ.HQ..Q.LFA.S.NP..EDPI.LYLF..IFXEX...SUO.AP.CZP.JXPUS.W.D.WU...

result:

ok Correct.

Test #10:

score: 0
Accepted
time: 17ms
memory: 15536kb

input:

1000 1000
.SKFDQ.AV.GPTHMF.PL.YOQRQOXDOF.XVZ.H.MYOJIYT.QZNJQI.ZZMAJ.OAWBJBRXFW.CLEPPKGGAWGTVBKOBL.GPCO.ML.DBL.A.RJ..GF.EHK.CDXLLTCBCL.CGYJBMUSPIN.QELGYW.JE..CFVQF.LVYLFHYJ.MY.FZ.RU.ODLAYTWIZQOQZXBW.BVD.RFPLHLEHAU.G.PLFWFUKA.RSG..AVU.SA.PWRGJYO.OXD..S.Z.LIIADT.YXH..NHWXY.R.YFLS.URIJGPPURZPPVHJFLMKTDT...

output:

YES
S.FDQ.AV.GPTHMF.P..YOQRQOXD.F.XV.....YO.IYT.QZ.JQI.ZZMAJ.OAWBJBRX...C.EPP.GGAWGT.B..BL.GPCO.ML.D.L.A.R...GF.E.K.CDXLLT.BCL.CGYJB.USPIN..EL..W.J...CFVQ..LV.LFHYJ.MY.FZ.R..ODLAYTWIZQO.ZX.W...D.R..LHLE.A..G.PLFWFUKA.R.G..A...SA..WRGJ...OXD....Z.L.I.DT.Y.H..N.WXY.R.Y.LS..RI.G.PU.ZP.V..FLMKT.TWI.ZKHZ...

result:

ok Correct.

Test #11:

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

input:

1 1000
.K.CCS...LC.....Y..J...E.W.B..Q..KQ...Q...L..U.XSWX..NB..K.OLF...Y.A....HG....RRQO..Y...J.LOS...IN..C......H......X.....B.B.PQRT....VB.........P...E....MF.E...RH.XADCQN.D.KT.W..XNI..PH.Q.L.H..G...ZJR.V.I.......O......J.X..N..QS......UN....HLS..Z..N....X.YH.W..E.Z..JHSAV......YXT.P..TX.WT.SHE....

output:

YES
K.CCS...LC.Y.W.Y..J...E.W.B..Q..KQ..EQD..LT.U.XSWX..NB..K.OLF...Y.A....HG.BH.RRQO..Y..PJ.LOSU..IN..C......H......X.....B.B.PQRT...QVB...V..K..P...E....MF.E...RH.XADCQN.D.KT.W..XNI..PH.Q.L.H..G..ZZJR.V.I.......O.....DJ.X..NC.QS......UN....HLS.TZ..N....X.YH.W..EBZZ.JHSAV......YXT.P..TX.WT.SHE...YG...

result:

ok Correct.

Test #12:

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

input:

2 1000
.D..JPYBD.H..F.I.NTFC.VJKS..Q.PBW..XLW.ZS..ATCTMPPKRK.V.NN.MPE.SPN.QODI.H...OR.V..INXOZMGF.KIS.GANJ.WV.YLALHHXO..M.TMTJ..XYP.N.BUENZCUA.I.XJO.Q.NVG.B.TXNI.TVLY.N.CWE.ZEO.ANYRZ.W.PQI.LORBYIYJIK.JZ.PENB.HPJPTIIGVOMF.RPZ..WFM.IS..H..U.ZEX.DXZU.YHM.UOMPOHV.HW..SZ.RHWXW.SZH.....R.X.R.L.JRYLL.CE.IE...

output:

YES
..JJPYBD.H..F.I.N.FC.VJKS..Q.PBW..XLW.ZS..ATCTMPPKRK.V.NN.MP..SPN..ODI.H....R.V..INXOZMGF.KIS.GANJ.WV.YLALHHXO.....MTJ...Y..N.BUENZCUA.I.XJO.Q.N.G.B....I.TVLY.N.CWE.ZEO.ANYRZ.WBPQI.LORBYIY..K.JZ.PENB.HPJPTI.GVOMF.RPZ..W.M.IS....QU.Z.X.D.ZU.Y.M.UO.POHV.HW..SZ..HWXW.SZ......R...R.L.J.YLL.CE.IEZDX....

result:

ok Correct.

Test #13:

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

input:

1000 1
.N.
N.N
G.G
...
...
.x.
U.U
...
.x.
P.P
K.K
..O
.x.
.x.
Y.Y
...
.x.
..D
.x.
...
J.J
Q.Q
E.E
.x.
A..
W..
.x.
H.H
D.D
...
...
E.E
..H
..A
.x.
...
C.C
..E
O.O
...
..Z
J.J
...
..Y
P.P
W.W
X.X
G.G
...
...
...
...
L.L
F.F
B.B
.x.
K.K
R.R
U.U
F.F
.x.
...
...
...
B.B
...
L.L
.x.
E.E
N.N
Z.Z
...
Z.Z
W...

output:

YES
N
G
.
.
.
U
.
.
P
K
O
.
.
Y
.
.
D
.
.
J
Q
E
.
A
W
.
H
D
.
.
E
H
A
.
.
C
E
O
.
Z
J
.
Y
P
W
X
G
.
.
.
.
L
F
B
.
K
R
U
F
.
.
.
.
B
.
L
.
E
N
Z
.
Z
W
.
.
.
I
V
P
.
.
J
K
D
X
Y
.
.
.
S
.
X
.
.
J
F
O
S
N
.
D
.
.
E
U
.
.
T
C
D
M
.
.
.
T
.
.
.
.
.
F
.
.
Y
E
K
.
.
.
.
T
.
.
.
.
G
T
.
A
.
H
R
X
.
.
.
.
U
...

result:

ok Correct.

Test #14:

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

input:

1000 2
.HE.
.xx.
....
H..E
..x.
Z..N
U.xU
..x.
Rx.R
A..A
D..L
J..T
..x.
A.xA
Ax.A
...V
.x..
F..F
.x..
U..Q
Bx.B
F..X
E..E
...G
B..V
..x.
.x..
..x.
E.xE
...I
..x.
...W
Tx.T
.x..
Tx.T
H..H
K..K
M..I
..xK
V..I
.x.Y
...V
....
A..M
B.xB
Hx.H
A.xA
...K
...X
O...
J..X
S..U
X..M
F.xF
..x.
M..I
D.xD
Y.xY
Hx....

output:

YES
..
HE
HE
..
ZN
U.
..
.R
AA
DL
JT
..
A.
.A
.V
..
FF
..
UQ
.B
FX
EE
.G
BV
..
..
..
E.
.I
..
.W
.T
..
.T
HH
KK
MI
K.
VI
.Y
.V
..
AM
B.
.H
A.
.K
.X
O.
JX
SU
XM
F.
..
MI
D.
Y.
.H
XF
SX
AK
.R
B.
..
..
KE
NN
Z.
..
BI
PV
ZD
.D
.G
..
RR
V.
.O
EE
..
C.
.J
SP
..
GG
JI
..
.P
DH
..
QQ
..
V.
ZL
W.
QC
P.
KK
.O...

result:

ok Correct.

Test #15:

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

input:

1 1
.M.
M.M
.M.

output:

YES
M

result:

ok Correct.

Test #16:

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

input:

2 2
.FG.
F..G
D..D
.DG.

output:

YES
FG
D.

result:

ok Correct.

Test #17:

score: 0
Accepted
time: 12ms
memory: 14424kb

input:

1000 1000
.SALZWWWEFVNIEX.ZDPPWJHROFIITXR.CSOKTMFFUGSA.UW.X.QYXWNAC.YCVHOGAHGZQAJWINRU.Z..CCFQKASZXMPWSQGILOT.N.PKGZ.JWPZ.ALPWSOFCMWABPW.ZAFSQQUASJHPIAMITPJEAJLKMGVGDOHFFNYKKXFHUIPFYDPQ.RWKD.PWLTQPZGPMYPQHOAGOHIDQMFGJU.MLXPCUK.ES.KZHPRLBGCTGYHPVYMX.DFAZODQ.QXANEJTISMUGV.LIGKZDSNOC.NDWM.N.JYHJIWCBQ.L...

output:

YES
..LZW..EFV.IEX.ZDPPW.HROF.ITXR..SOKT.FFU.S..UW.X.QY.WNAC.YCVHOGAHGZQ.JW.NRU.Z...CF..A..XMPW.Q...OT.N.PKGZ..WPZ.ALP.SOFCMWABPW.ZAFSQQ.ASJHPI.M.TPJ.A.LKMGVG.OHFFNYK.XFHU.PF.DPQ...KD..WLT.PZGP...Q.OA.O.ID.MFGJU..LX...K.ES.KZHPR..GCTGYHPV..X..FA.O.Q.QXANE...S.UG....GKZDS..C.NDW..N..YHJIW.B..LIU.N.NI...

result:

ok Correct.

Test #18:

score: 0
Accepted
time: 20ms
memory: 14600kb

input:

1000 1000
..EYLAGAENPDPZMGY.K.MSRTZBHDENS..YJRW.IWCLBIQQICT.ODBUMXFPO.UDPELUBMQSLZ.EHIVABC.ME.NQQI..QEHTIIFGJQWZSLDNDKGWA.UGMR.CJ.RPAQYJUAIIFQAMRAWECAAFHV.GUGIXROGEYDUX.FUUP.JKSYZITIHMSCKEQQKU.SFAXDPIPSHHYGGYLLEHUHZYRKYBKNAAOAWZHPRKHIQRZJXO.LMJUHDR.AWTBOEEJIHRH.XBUDQHGHKSL.SKW.SZZNIZAF..PK.NVOIMECDI...

output:

YES
.......................ZB.DE.S..Y.RW.IW.L.IQ..CT.O.BUMX....UD.ELUB.QSL..E..VABC.ME.N..I...EHT..F...W.S.D..KGW..UG.R.C...PAQYJUAIIFQA.R....AAFHV.GUG..ROG..DUX...U..J.S....IHMSCKE...U...AXDP...HH.G..L.E.UHZY.KY.K.AAOA..HPR.HI.RZJ...LMJUH....WT..E.JI.RH..BU..HGHK.L.S...SZZ.I..F........IME..IKXFG.J....

result:

ok Correct.

Test #19:

score: 0
Accepted
time: 21ms
memory: 13872kb

input:

1000 1000
.YOTYESJGMDJYFO.GICQVC.PBBNUUXFEIX.OJ.DBWOESWK.TEI.DITEQKIKC.QOTZBX..UB..SW.ODDBU.ZDILJKQYEM.CXOWRNAX.RYRPM.VMVYI.PBYXXUDDAFQUMAI..UFRHYOQA.PUWEP.AHEMMHMRCEZRFJQRWKLVXA.HXPHIMHV.SEHGFEJB.WRT.EYCWPI.CTERLDCPFUXKOWGIVNJKKOPUZRZI..NCHBODRTVKZRNHGTOQTYAKSEBA.TEX..EFIVBSBFOAJ.M.PXGTMHN.PRAPFIDD...

output:

YES
..............X.IC......BN......X..J...W.ESWK.......TEQ.I...QOT..X..UB..S...D..U..D.L..QYEM..XOWRNA..RY..M.V..Y..P...X......U.A...UFRH...A.PU.E..AHE.M....EZR.J.RWK.VX..HX.H.M....E.GF.JB..RT.E.C.PI.C.E.L.CP..X..W.I.N..KO..ZRZI..N....DR.V.Z.N.GTOQ.Y..SE.A.T.X..E..VB.BFO.J.M.PX..MH..PRAPF..DH.O.G.T...

result:

ok Correct.

Test #20:

score: 0
Accepted
time: 7ms
memory: 14332kb

input:

1000 1000
.HXXXGGPVDEYBGKDYLMRYKPIY.B..BQBPSH.DHV.RNWZKUYVSVELVLW.IAZZSBAGJSPHY..LFURSTQY.BTDPZ.GQCCNHBHJNUBDRQRGESN.TIGYPZVZ..MAWLKSUBOR.OJ.FEYPDJBAI.WV.EYBPRKNB.V.NY.QESGNGLNTUF.EY.EOIUPSETRWU.AWLP.DCBRZ.IDJIZW.UEJYDHPYOJPH.QJJAR.EOYFQKOSXUK.LNXOHJNINT.NVJFEGZOMSJQT.XHISZWU.Z.GYGELPGGDVTFAGA.TSYDN...

output:

YES
.....................P......BQ..S..........KUY......L.......B..............T......P.....C..B.J........................WL..........F.......I........R.NB.........G.G.............P.........L..D......DJ.Z........P...P..Q......O...................T.........M.....X.......Z...G.L.GGD....G..........M......

result:

ok Correct.

Test #21:

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

input:

1000 1000
.CCFMBZB.AUU.H.ZXYVAIMTA.D.JJIPERQWJVCTTAKSARUVYRPOPQMNFTNMPUBAZLCD.NXITOLEGFETDCOOBBGTL.U.IDCGBOOWFZ.VAWT.BXDK.YXRPTAVKNVAEMTDFY.UEUJCXSVZTYVJIN.ZOXGSTHSGUJWPTSLSUKFZDICKCPNTF.TTVUZUWAWFIPJ.HSXCJWRLDXZPXSHYLE..VZDEXCIGCFVBJBRNLAZDYXYGBDSRJUKRLVGREJGHMBFFK.SQSFXVDXBOULXPVHXPXKDZADDQA.JJCLE...

output:

YES
.................................................................................................W.........................................Y..........................................................D.............................................................X......................................

result:

ok Correct.

Test #22:

score: -100
Wrong Answer
time: 7ms
memory: 18772kb

input:

1000 1000
.YYJG..U..V.ZKZL.MR.Y.BFP.RK.Y...Y.P...LZ.HB.FECA.O...DDWYTFMKZZ.RZ..AJD....ND.P.B...MPYOAU.DYJX..Y.UEUN..IVDN.C..WXXF...FRP...A..NP.B.O.Z.D..LFC.F..TR.G..M..ULQ..VPC..X.DHPY..UGO.F.P.BM.R..HXJ..STSJMS.Q.AZMF.EF..OXMSV.BAG..ADIR.FD.QDJN.DM...NKI...IYMNE.CP...J...G.KSX..B.J.HLYJC.PMBBJG.F.....

output:

0 @ 28 1001
NO

result:

wrong answer YES or NO expected in answer, but 0 found.