QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#422567#8679. Tilting TilesEric_caiAC ✓160ms21320kbC++145.2kb2024-05-27 16:22:102024-05-27 16:22:10

Judging History

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

  • [2024-05-27 16:22:10]
  • 评测
  • 测评结果:AC
  • 用时:160ms
  • 内存:21320kb
  • [2024-05-27 16:22:10]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=1e9+7;
const int base=131;
char c[505*505];
int n,m,a[505][505],b[505][505],len,d[505][505],cnt,tmp[505][505];
char s[505][505],t[505][505];
void ch(int k)
{
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++) b[i][j]=0;
    if(k==0)
    {
        for(int i=1;i<=n;i++)
        {
            len=0;
            for(int j=1;j<=m;j++)
                if(a[i][j]!=0) b[i][++len]=a[i][j];
        }
    }
    if(k==1)
    {
        for(int i=1;i<=n;i++)
        {
            len=m;
            for(int j=m;j>=0;j--)
                if(a[i][j]!=0) b[i][len--]=a[i][j];
        }
    }
    if(k==2)
    {
        for(int j=1;j<=m;j++)
        {
            len=0;
            for(int i=1;i<=n;i++)
                if(a[i][j]!=0) b[++len][j]=a[i][j];
        }
    }
    if(k==3)
    {
        for(int j=1;j<=m;j++)
        {
            len=n;
            for(int i=n;i>=1;i--)
                if(a[i][j]!=0) b[len--][j]=a[i][j];
        }
    }
}
int cir[10][8]={{},{1,2,0,3},{1,3,0,2},{0,2,1,3},{0,3,1,2},{2,1,3,0},{2,0,3,1},{3,1,2,0},{3,0,2,1}};
bool check()
{
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(c[a[i][j]]!=t[i][j]) return 0;
    return 1;
}
bool fl,ff;
int vis[505*505],to[505*505],sz;
ll hh[2*505*505],p[2*505*505],w;
char str[2*505*505],chr[2*505*505];
int res[505*505],tp[505][505];
ll get_hh(int l,int r)
{
    return ((hh[r]-hh[l-1]*p[r-l+1])%mod+mod)%mod;
}
int main()
{
    //freopen("1.in","r",stdin);
    //freopen("1.out","w",stdout);
    int now,r,md,lst,pr;
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    c[0]='.';
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++) cin>>s[i][j];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++) cin>>t[i][j];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(s[i][j]!='.')
            {
                d[i][j]=++cnt;
                c[cnt]=s[i][j];
            }
    for(int i=1;i<=8;i++)
    {
        //if(i!=2 && i!=7) continue;
        memcpy(a,d,sizeof(a));
        for(int j=4;j<8;j++) cir[i][j]=cir[i][j-4];
        for(int j=0;j<=3;j++)
        {
            //if(j!=0) continue;
            fl|=check(),ff=1;
            memcpy(tmp,a,sizeof(tmp));
            for(int k=j;k<j+4;k++)
            {
                ch(cir[i][k]);
                memcpy(a,b,sizeof(a));
            }
            memcpy(tp,a,sizeof(tp));
            for(int k=j;k<j+4;k++)
            {
                ch(cir[i][k]);
                memcpy(a,b,sizeof(a));
            }
            memcpy(a,tp,sizeof(a));
            for(int x=1;x<=n;x++)
                for(int y=1;y<=m;y++)
                    if((a[x][y]==0 && t[x][y]!='.') || (a[x][y]!=0 && t[x][y]=='.')) ff=0;
            if(ff==1)
            {
                for(int x=0;x<=n*m;x++) res[x]=-1;
                for(int x=1;x<=n;x++)
                    for(int y=1;y<=m;y++)
                        if(a[x][y]!=0) to[a[x][y]]=b[x][y],chr[a[x][y]]=t[x][y];
                for(int x=1;x<=cnt;x++) vis[x]=0;
                for(int x=1;x<=cnt;x++)
                {
                    if(vis[x]==1) continue;
                    now=x,w=hh[0]=0,p[0]=1,sz=0;
                    while(vis[now]==0)
                    {
                        vis[now]=1,sz++;
                        hh[sz]=(hh[sz-1]*base+c[now])%mod,w=(w*base+chr[now])%mod;
                        p[sz]=p[sz-1]*base%mod,str[sz]=c[now];
                        //cout<<c[now];
                        now=to[now];
                    }
                    //cout<<'\n';
                    //for(int pos=1;pos<=sz;pos++) cout<<str[pos];
                    //cout<<'\n';
                    for(int pos=sz+1;pos<=sz*2;pos++)
                    {
                        hh[pos]=(hh[pos-1]*base+str[pos-sz])%mod;
                        p[pos]=p[pos-1]*base%mod;
                    }
                    md=sz,r=sz,lst=0;
                    for(int pos=1;pos<=sz;pos++)
                    {
                        //cout<<pos<<' '<<get_hh(pos,pos+sz-1)<<' '<<w<<'\n';
                        if(get_hh(pos,pos+sz-1)==w)
                        {
                            if(lst!=0) md=pos-lst;
                            r=pos-1,lst=pos;
                        }
                    }
                    if(r==sz) ff=0;
                    //cout<<r<<' '<<md<<'\n';
                    for(int pm=2;pm<=md;pm++)
                    {
                        if(md%pm!=0) continue;
                        pr=1;
                        while(md%pm==0)
                        {
                            pr*=pm;
                            if(res[pr]!=-1 && res[pr]!=r%pr) ff=0;
                            res[pr]=r%pr;
                            md/=pm;
                        }
                    }
                }
                fl|=ff;
            }
            memcpy(a,tmp,sizeof(a));
            ch(cir[i][j]);
            memcpy(a,b,sizeof(a));
        }
    }
    if(fl==1) cout<<"yes\n";
    else cout<<"no\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 25ms
memory: 10752kb

input:

5 7
..g....
.......
h.i.j.k
abcde.f
..lmn.o

hbgdj.k
a.ime.f
..c.n.o
..l....
.......

output:

yes

result:

ok single line: 'yes'

Test #2:

score: 0
Accepted
time: 26ms
memory: 12884kb

input:

5 7
..g....
.......
h.i.j.k
abcde.f
..lmn.o

g......
.......
hijk...
abcdef.
lmno...

output:

yes

result:

ok single line: 'yes'

Test #3:

score: 0
Accepted
time: 29ms
memory: 10808kb

input:

5 7
..g....
.......
h.i.j.k
abcde.f
..lmn.o

.......
..g....
..i.j.k
h.cde.f
ablmn.o

output:

yes

result:

ok single line: 'yes'

Test #4:

score: 0
Accepted
time: 15ms
memory: 8232kb

input:

5 7
..g....
.......
h.i.j.k
abcde.f
..lmn.o

......g
.......
...hijk
.abcdef
...lmno

output:

yes

result:

ok single line: 'yes'

Test #5:

score: 0
Accepted
time: 29ms
memory: 10888kb

input:

5 7
..g....
.......
h.i.j.k
abcde.f
..lmn.o

......g
.......
...hijk
.abcdfe
...lmno

output:

no

result:

ok single line: 'no'

Test #6:

score: 0
Accepted
time: 16ms
memory: 14568kb

input:

8 10
axudxmgb..
rpyvs.....
fozux.....
xnve......
hx........
t.........
c.........
..........

cxvgxpea..
toyur.....
dnzvx.....
xmuh......
fx........
s.........
b.........
..........

output:

yes

result:

ok single line: 'yes'

Test #7:

score: 0
Accepted
time: 29ms
memory: 9728kb

input:

9 7
kbi...b
....mm.
.c.fc..
...j.k.
..f..j.
m....f.
.igl.fl
.g...a.
...f...

k.j....
am.l...
.....ib
..i.m..
..gg.c.
.....ff
.mf....
jf..f.k
cl..b..

output:

no

result:

ok single line: 'no'

Test #8:

score: 0
Accepted
time: 30ms
memory: 14872kb

input:

5 6
iyazl.
bzxf..
yzxe..
czdzzy
j..yk.

jyfziy
azxez.
yzxdl.
bzcz..
ky....

output:

yes

result:

ok single line: 'yes'

Test #9:

score: 0
Accepted
time: 22ms
memory: 14944kb

input:

5 6
iyazly
bzxfz.
yzxek.
czdz..
jy....

kyfzjy
azxez.
yzxdi.
bzcz..
ly....

output:

no

result:

ok single line: 'no'

Test #10:

score: 0
Accepted
time: 26ms
memory: 10748kb

input:

3 3
...
.a.
...

...
.a.
...

output:

yes

result:

ok single line: 'yes'

Test #11:

score: 0
Accepted
time: 113ms
memory: 15224kb

input:

500 500
abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

no

result:

ok single line: 'no'

Test #12:

score: 0
Accepted
time: 160ms
memory: 21320kb

input:

500 500
abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

no

result:

ok single line: 'no'

Test #13:

score: 0
Accepted
time: 150ms
memory: 17228kb

input:

496 495
oanhdonngaokopboqljdalgpfdeqfelhjchogdmrcaqb.ooogggggicgenlbipaprnfbcrapabfjaemrhdelojgbldirmidgihpjfobgopinddhhmacjcqljgajndcgemiepgipqmdgcqndqadkialgjddpkdfhamldedgrejbbgirpmbeqjc.mbipndabllbjbgrlbrhrcaiphrpogicjdcqeqdhdldpefdekqqihifhagjokepbbceqprongafeqmhbripqceodmfaecpgnaenfjjrjbbabaec...

output:

yes

result:

ok single line: 'yes'

Test #14:

score: 0
Accepted
time: 92ms
memory: 15196kb

input:

367 490
ababbaabbbabbabaabbabbbabababbbabaabbbabbababbabbaaaabbbbaaabbbbababaaaaabbaabaabbbabbbbbababaaabbabaabbaabaabbbabbbbabbbabbabbabbabbbababbabbaaabaabaababaaababaabaabbbbbaaaaabbaaaaabbababaababbaabaabaaaababbbbbaabaaababbabbbbaabaabbabbabbbbaaabbaaababbbaaabbbaaabbbbaabbaaabbbabaaaaaaaaaabaa...

output:

yes

result:

ok single line: 'yes'

Test #15:

score: 0
Accepted
time: 149ms
memory: 21300kb

input:

500 500
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii...

output:

yes

result:

ok single line: 'yes'

Test #16:

score: 0
Accepted
time: 159ms
memory: 21312kb

input:

500 500
tztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztz...

output:

yes

result:

ok single line: 'yes'

Test #17:

score: 0
Accepted
time: 29ms
memory: 10772kb

input:

2 4
.xxx
..xx

xx..
xx..

output:

no

result:

ok single line: 'no'

Test #18:

score: 0
Accepted
time: 29ms
memory: 9740kb

input:

5 8
........
........
.aaaaa..
........
........

........
........
........
........
..aaaaaa

output:

no

result:

ok single line: 'no'

Test #19:

score: 0
Accepted
time: 29ms
memory: 10844kb

input:

5 8
........
........
.aaaaaa.
........
........

........
........
........
........
...aaaaa

output:

no

result:

ok single line: 'no'

Test #20:

score: 0
Accepted
time: 132ms
memory: 17200kb

input:

500 500
fwizgbybbgxihqejzkgyvdcrgzkfhfktchdilsfgigilfktykliwrykymilrmjjmrlimykyrwilkytkflihifguljdhctkjhgkzfrcdvyfkzfexhxifbbybgziwg...........................................................................................................................................................................

output:

no

result:

ok single line: 'no'

Test #21:

score: 0
Accepted
time: 124ms
memory: 17112kb

input:

500 500
hkmkgolmmlokbyyeohmmvmkhbpgmmkypmbmkmhcqvcbkkkbkbbkkwkkobrrdjkjgelllvclldgcvlddxclxvhvwlglkxsxklglwvhvxlcxddlvcgdllcvlllocaxaarrbokkwkkbbkbkkkbdvzkkmkmbmpykgmgpbhkmvgghoeyybkolgglomkmkh..............................................................................................................

output:

no

result:

ok single line: 'no'

Test #22:

score: 0
Accepted
time: 150ms
memory: 17112kb

input:

500 500
xueftjjjxjyzctkjocmokbkomcojktczyjxjjjtfeuxexumbooocaoljckojectkrketulbzlejoxoloxojelzblutekrktcejokcjloacooobmuxexueftjjjxjyzctkjocmokbkomcojktczyjxjjjtfeuxexumbooocaoljckojectkrketulbzlejhxoloxojelzblutekrktcejokcjloacooobmuxexueftjjjxjyzctkjocmokbkomcojktczyjxjjjtfeuxexumbooocaoljckojectk...

output:

no

result:

ok single line: 'no'

Test #23:

score: 0
Accepted
time: 30ms
memory: 15940kb

input:

1 6
..h...

h.....

output:

yes

result:

ok single line: 'yes'

Test #24:

score: 0
Accepted
time: 30ms
memory: 14872kb

input:

5 7
...sr.k
.pits.t
..gss.m
q.hubko
..xi.bb

.....sk
...okbi
...mssu
..trsgx
qptihbb

output:

yes

result:

ok single line: 'yes'

Test #25:

score: 0
Accepted
time: 26ms
memory: 15840kb

input:

4 2
.e
..
..
..

..
..
..
e.

output:

yes

result:

ok single line: 'yes'

Test #26:

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

input:

9 10
..........
......f...
..........
..........
....k.uo.k
..........
..........
......k...
..........

......kfok
.........u
.........k
..........
..........
..........
..........
..........
..........

output:

yes

result:

ok single line: 'yes'

Test #27:

score: 0
Accepted
time: 30ms
memory: 14936kb

input:

5 10
.n.n.icfbl
.c.hb..kkj
.l.dd...cg
.b.bh..bge
lh.j..ikpb

cifl......
nikkb.....
bdhbcg....
nhdbkgj...
lcbljhpeb.

output:

yes

result:

ok single line: 'yes'

Test #28:

score: 0
Accepted
time: 44ms
memory: 15036kb

input:

186 354
b....c....b..c....c....a...cb.a..aaa.....aac......c......aa..a....b....aaa.ca..c.a...bb..c..bcbb.bccaaa.a.a..c......cc.a..aa.abab.b.ba....c.c.bba.ba.c....cc..aa....ab..abb..c.a.b.c......b.b.a...cc.cb..c..b.....ac.c..a.cb.c.bbb......b..b.a...caab....a.aaccabba..a...aac..ccbab..a....b....a.a.....

output:

yes

result:

ok single line: 'yes'

Test #29:

score: 0
Accepted
time: 26ms
memory: 14936kb

input:

10 49
.kfmb.inlmmeeqj.mmgldemgoiklmm..gbgmm.lflmfpillmm
dmmaj.okllj.bhojoj.dklpkbohjoenqjjlkp.ohqjodaecdq
.oekcjhoalrhkpk.fdhlmbjrjoired.ocbrdo.qrmjlkobk.m
.mdbjol.l.m.rcn.jq.aqi..lqckgm..h.qemcipfdhkodc.i
.rlokjoei.m.bbpnoj.lik.akfjroek.i.iff.qbrndojaa..
cmafo.o.dhe.dkn..k.kfomkajoag.aaehh.m.eigdok...

output:

yes

result:

ok single line: 'yes'

Test #30:

score: 0
Accepted
time: 81ms
memory: 17040kb

input:

493 266
....gg..d..e.ff..f..bhaa.d.....c...gidee...e.i...e....dch.....a.g.ebb..cce.fe.cbhi.f.....i..c.c..d.........b...c........e..bd..fidd..ic..g.e.a.icacb..bd.id.c.fi..cdhfd..i..a...gde...gg...agd..cbi..c.g...c.g..i..b.dh..d...id..c.i.....bh.id.fbaa..fc.f....a.h...ediaggf
c...hcaaba...iggcgf.i.fea...

output:

yes

result:

ok single line: 'yes'

Test #31:

score: 0
Accepted
time: 59ms
memory: 16576kb

input:

255 381
ub........d..p...............l..kk..s..nd.....i.vx.lu..tx..y.n.m.....f..b.q.yc..t...f.....throlw.o.n..g.dn....rby.y......y.a.i..n...e.if......m.f..eg.i.q.....na.....nq..aaw.r..bfi..a.sb.c...bon.o..t....ab.up....e.rw.o.mt.....i...hs..lkj.iewb...oqn.f..u.b..q..i..q..rp....c..b.ptq..l...ks.q......

output:

yes

result:

ok single line: 'yes'

Test #32:

score: 0
Accepted
time: 34ms
memory: 16400kb

input:

183 61
...abaa.bbcbcbcacbacaacccbbbaaaaababcbbcbcbac.cbabaabbbc.bbca
.....abcbab....ccc...bbacc.cccc.c..ac...aba.aab......ab...cc.
......c...b.........c..b..b.......b........a........b........
...abc..ca.bb..bca.b.cb...cc.a.bcbacba..c.b.c.b...c..c..b..a.
................................................

output:

yes

result:

ok single line: 'yes'

Test #33:

score: 0
Accepted
time: 86ms
memory: 14928kb

input:

500 500
j...p....hk....wiwo..k...b..p...n...y...g.............og..h..q.h..l.....p....f.....y..rji.....j...r.a....t.d.......mwvv..j...lxn.....b...mc.....l..x.r.f..d.......n...v..bnv...f.f..d..v.....j.....f.......w........qrce....k.w..t.k.........v...ke.hg...w....t..j..p.....x......wk.dw..qgnyr.v..na....

output:

yes

result:

ok single line: 'yes'

Test #34:

score: 0
Accepted
time: 135ms
memory: 15224kb

input:

500 500
.ec...a...fbb.aa....de.....e.......bd..bdeeeff.a.b...........c....e.ca.dbe..eedaa..d.cddc..c..ccbdc.aee...c.fce.d...e..fddfb......b..ea..fa......a..cead.e.f.d....bc......ea...a.f..a....a.....efc.d.cfe.baf.e.e.c..d..a....c..ec..d....ebc.ec.......ddbc...ebb.ff..dead.b.ac..fe..ce.e......a.a.e.e...

output:

yes

result:

ok single line: 'yes'

Test #35:

score: 0
Accepted
time: 143ms
memory: 15440kb

input:

500 500
djebdknlnkkkkkdbnmdhjimlkgkmdahblbch.hnlddcehclbekbafhkfahagmhiieah.kkknklcaielnfnendejgaffiekjkkkidmicnkmdgaikmjcgehebhigcjhbmijndemeljdkechaebdnlkmikkkckdgnhaadmnhmjhkfbjdcdkgkkkkiflndcchhgfkcfelnnmdhhgieachdhfghihieikfchenmiemejbkkkikfddi.dnadmfdegklkbghikfkkkmhdmkgnmiifjkbanhkfhdhcabfdn....

output:

yes

result:

ok single line: 'yes'

Test #36:

score: 0
Accepted
time: 114ms
memory: 15016kb

input:

500 500
l.hd........d.....lva..s....i...r...r....j...b...sth.frs.ik....t............p.k.qq..m.......b.....m.gvi...f.t..qf.....t..dt.p.b.......eg.u...q.v.........s.h...ip.kc..i.h..d...v.m.b....hb.ld.r.m..hlhu...u...e....l.i...k.m.cdu.......vj..e...l....m...m.n..........a..tc.....ai..a....o.....om..p....

output:

yes

result:

ok single line: 'yes'

Test #37:

score: 0
Accepted
time: 113ms
memory: 17024kb

input:

500 500
igb..hi.fc..ede..d..ehacfaia.f.g.hb.ad.......h.hichfd...ae.agi.gegi.a...ddhfbdi.hh.b.ib...g.biifh..a.d.hhab.a..acec.gh..a.hfdc.bch.i..daia.dcda.bieachifd.bbahbd..c..hbbcd.aeiie.cb.dfha.h.haggcbfaiba.hda.dfhigce.e.ehg.ce.fh..bcbee.hhdg.gciff.egee...a.ghd..d.gbcbiaiga...i.ehb.dd.ahiedef.ddggi....

output:

yes

result:

ok single line: 'yes'

Test #38:

score: 0
Accepted
time: 23ms
memory: 16920kb

input:

10 1
c
.
.
.
.
.
l
.
c
b

c
l
b
c
.
.
.
.
.
.

output:

no

result:

ok single line: 'no'

Test #39:

score: 0
Accepted
time: 15ms
memory: 13008kb

input:

9 4
k...
..n.
hhbh
.fdd
fda.
..ok
.lef
..k.
eobm

khan
kfoh
fdef
elkh
obd.
b...
d...
m...
....

output:

yes

result:

ok single line: 'yes'

Test #40:

score: 0
Accepted
time: 11ms
memory: 11960kb

input:

7 7
...c..c
c...c..
d...b..
....c.a
.......
b.cbcb.
.......

.cbdccc
...bcbc
.....ba
......c
.......
.......
.......

output:

yes

result:

ok single line: 'yes'

Test #41:

score: 0
Accepted
time: 11ms
memory: 14184kb

input:

10 4
....
....
..wn
....
....
....
....
....
....
....

....
....
....
....
....
....
....
....
....
..wn

output:

yes

result:

ok single line: 'yes'

Test #42:

score: 0
Accepted
time: 25ms
memory: 15900kb

input:

3 5
m....
h.k..
g....

...mg
....h
....k

output:

no

result:

ok single line: 'no'

Test #43:

score: 0
Accepted
time: 38ms
memory: 16460kb

input:

238 218
....v.w.mk.dkwi....qz...fyae...xjz..bdk..uuetxo......q.j...d.hta..mu.ha....cqlg.cbou..l..gc..w.fryubayqj.sf......av.r..z..fvt..i...uf.g...........m...mn.w.mj.x......q...q.xgxbnq.fqjoo......qxvc.qnr...f..cbb.....n.....y
....e...i..x.e..................b....tk..w.......w.......c.i.w..w..k........

output:

yes

result:

ok single line: 'yes'

Test #44:

score: 0
Accepted
time: 111ms
memory: 17000kb

input:

487 438
..dc.f.dhcaefc.ag.d.cjc..e.je.hfib.ib.j.e.dccjacd.jh.ccc..hhc.g...h.cicccg.i.gccac.haec..h..ab.c.fheij.c.jc.bdh.c.gcg.c.j.g.f.j.h.d...ba.aifbd.gc.chgbed..gjif.de.ec.g.jjeeccacif..c.jgjc.cec.ff.jc.eg.ddeghecj.dfc..ff.gghch..j..hbi.dahagbb.ggd.f...jibe.g.fcg.ejcjeeecj..ghajgi..e.dcb.ciid.efdb....

output:

yes

result:

ok single line: 'yes'

Test #45:

score: 0
Accepted
time: 24ms
memory: 16988kb

input:

15 461
b.dbc.gec..eg.....dde.d...cg.c....fab....aae....f.a..be.c...fg.e.......bed.a.a..g...fa......c....b....g....d...dc.b......b..c..fb..cf...a.....dac.g....f...ec.db.bfdgcg...c.d......d.......ec...b....g..a......gd.ggc..d.g...f.bb.f.c..f....gb......f..a.dc...d...dfefc....a.g.e..a.d..d.e.b...g..ea....

output:

yes

result:

ok single line: 'yes'

Test #46:

score: 0
Accepted
time: 34ms
memory: 14940kb

input:

428 49
ndj...mh..g.m.i.b..kb.j..nei...lgffe..c.hej.n...i
genbamkh...l..lfff.h.kca.gc.mdh.ih...ica.ldnhhhik
.............................h.......h...........
a.cibcnhf.ibilebh.fhbfd.hl.n.fbd.b....ke.fa..e.kf
.................................................
...............e..fm.h.....d..hb.hh...h.......

output:

yes

result:

ok single line: 'yes'

Test #47:

score: 0
Accepted
time: 30ms
memory: 14860kb

input:

1 420
..d.c.cbb..d.abdda...c...bbc.db.d...d.b.b.a..bc.cd.abcccc.cb.a.ac.dd..d...c.caa..cbdd.cdb.a.bda.b.a..cbb...ab.b.b.c.bac.aaab..aa.dbb..ada..aaabab.d..baccbccdbbd.......a...c.bdcc..ddd.badd.cc..badbc.adbb....b.dd...bcb...bdb.d..aa.acab.ad.a..aa.ac.a.adbdbca.d.c..bcd.bdddcbc.cc.daac.cc.c.b..dcacc...

output:

yes

result:

ok single line: 'yes'

Test #48:

score: 0
Accepted
time: 114ms
memory: 16984kb

input:

500 500
...........a..........m...................b..............cg.....j................c................km.....k.............a.g...............................o.g....e.i.........h.....................n.............b....e..d....................l......................i...l.................f.....b..m...

output:

yes

result:

ok single line: 'yes'

Test #49:

score: 0
Accepted
time: 125ms
memory: 17156kb

input:

500 500
b.d.....d.ad.a.ccd...dc...d..bc...............ac........a....................b..............b.......d..c....ac......................d....d............b................c.....a.....a...d..b......................a.......d.b...b........a.......c.......a.....b.d................b..dd........d........

output:

yes

result:

ok single line: 'yes'

Test #50:

score: 0
Accepted
time: 139ms
memory: 21220kb

input:

500 500
ef..hfkbbfgg.ggfaj.i.l.f.fiigbgakld...bjjfladbg.ijkc..g.fkjjcebllbgd.hddh.abglbc.clilagc.cefifhij..gj.cfh.jka.gcf.e.dllkef.ggkffh.lkdgaji.fg.c.hga..ceajbjkkjejfhgcjiaf.dgfbihe.bkd.jeaec.gae.elbjh..b.fk.ileihddef.lgcbl.egfka.afhlgkfbkccklid.fh..igf..jckdca.jafeebhe.cfdgflfai.effi..cffbbd.j.gc...

output:

no

result:

ok single line: 'no'

Test #51:

score: 0
Accepted
time: 142ms
memory: 17236kb

input:

500 500
iah.fbgnlhahdbobnbojkgggafbfnianbnalnlmjbaafjgkmml.hangakeamfgjjhacancngnnnceolibdekjfgaljalhba.ncclbn.jhmohcnmleda.moimmkajenjcjkgmkalnaocafmnehaaaccmlaoggdldbkibomhkbf.gmnabdoahlamnfhfdngiofdnbhcdmbhfgbkiblhammhcngjenlolcchaaclmnjanbahbjkhmaheoolednbogcjmhajmljclfihhakbg.dfcobnagnlldbajkoa...

output:

no

result:

ok single line: 'no'

Test #52:

score: 0
Accepted
time: 139ms
memory: 17300kb

input:

500 500
clkabhi.kkecebhfeicieiggchhjcjdabekabkjihcgfckkdbkgj.jiifblalbjkcfgkfchkakjfgiclkjfbfbbcddcfgg.hjhiiiagabaiklaeaglaiafjeagceeebbahfabhiefbhfcfilgajhabkke.gcigebffaddfejadkfeibejcgeadlbjlikd.ebhjaaeeeafgkailljggbhekfbieiefikkbej.kfkbggdjgfibbafkfcbbj.adcgfckkiidhhgeaj.kkagbeebiklei.ebbhk.ekfk...

output:

no

result:

ok single line: 'no'

Extra Test:

score: 0
Extra Test Passed