QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#426590 | #8679. Tilting Tiles | Fesdrer | AC ✓ | 57ms | 14660kb | C++17 | 4.6kb | 2024-05-31 15:54:04 | 2024-05-31 15:54:05 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=505;
const int pre[]={2,3,5,7,11,
13,17,19,23,29,
31,37,41,43,47,
53,59,61,67,71,
73,79,83,89,97,
101,103,107,109,113,
127,131,137,139,149,
151,157,163,167,173,
179,181,191,193,197,
199,211,223,227,229,
233,239,241,251,257,
263,269,271,277,281,
283,293,307,311,313,
317,331,337,347,349,
353,359,367,373,379,
383,389,397,401,409,
419,421,431,433,439,
443,449,457,461,463,
467,479,487,491,499};
int n,m;
vector<vector<int>> a,ans;
int S[3*N*N],T[N*N];
int nxt[N*N];
inline vector<vector<int>> turn(vector<vector<int>> ori,int dir){//0u1l2d3r
switch(dir){
case 0:for(int i=0;i<m;i++) for(int j=0,k=-1;j<n;j++) if(ori[j][i]) ori[++k][i]=ori[j][i],ori[j][i]*=(j==k);break;
case 1:for(int i=0;i<n;i++) for(int j=0,k=-1;j<m;j++) if(ori[i][j]) ori[i][++k]=ori[i][j],ori[i][j]*=(j==k);break;
case 2:for(int i=0;i<m;i++) for(int j=n-1,k=n;j>=0;j--) if(ori[j][i]) ori[--k][i]=ori[j][i],ori[j][i]*=(j==k);break;
case 3:for(int i=0;i<n;i++) for(int j=m-1,k=m;j>=0;j--) if(ori[i][j]) ori[i][--k]=ori[i][j],ori[i][j]*=(j==k);break;
default:break;
}
return ori;
}
inline bool check(vector<vector<int>> x){
for(int i=0;i<n;i++) for(int j=0;j<m;j++) if(x[i][j]!=ans[i][j]) return false;
return true;
}
inline bool form_check(vector<vector<int>> x){
for(int i=0;i<n;i++) for(int j=0;j<m;j++) if(x[i][j]*ans[i][j]==0&&x[i][j]+ans[i][j]>0) return false;
return true;
}
inline pair<int,int> KMP(int len){
nxt[1]=0;
for(int i=2,j=0;i<=len;i++){
while(j&&T[j+1]!=T[i]) j=nxt[j];
if(T[j+1]==T[i]) j++;
nxt[i]=j;
}
pair<int,int> ret={-1,-1};
for(int i=1;i<=len;i++) S[i+len]=S[i+len+len]=S[i];
for(int i=1,j=0;i<=3*len;i++){
if(j==len) j=nxt[j];
while(j&&T[j+1]!=S[i]) j=nxt[j];
if(T[j+1]==S[i]) j++;
if(j==len){
int st=i-len;
if(ret.first==-1) ret.first=st;
else{
ret.second=st-ret.first;
return ret;
}
}
}
return ret;
}
inline vector<pair<int,int>> build(vector<vector<int>> st,vector<int> dirseq){
vector<vector<int>> now=st;
vector<char> ansid(1),stid(1);
int tot=0;
for(int i=0;i<n;i++) for(int j=0;j<m;j++) if(now[i][j])
now[i][j]=++tot,ansid.push_back(ans[i][j]),stid.push_back(st[i][j]);
for(int i:dirseq) now=turn(now,i);
vector<int> nxt(tot+1);
tot=0;
for(int i=0;i<n;i++) for(int j=0;j<m;j++) if(now[i][j]) nxt[now[i][j]]=++tot;
vector<pair<int,int>> ret(0);
for(int i=1;i<=tot;i++) if(nxt[i]){
int len=0;
for(int j=i,__;nxt[j];__=j,j=nxt[j],nxt[__]=0) T[++len]=stid[j],S[len]=ansid[j];
ret.push_back(KMP(len));
}
return ret;
}
inline bool check(vector<pair<int,int>> &rlt){
unordered_map<int,vector<pair<int,int>>> mp;mp.clear();
for(pair<int,int> i:rlt){
int m=i.second;
for(int j:pre){
if(m%j==0){
int cnt=0;
while(m%j==0) m/=j,cnt++;
if(mp.find(j)!=mp.end()) mp[j].push_back({i.first,cnt});
else mp[j]=vector<pair<int,int>>{{i.first,cnt}};
}
}
if(m>1){
if(mp.find(m)!=mp.end()) mp[m].push_back({i.first,1});
else mp[m]=vector<pair<int,int>>{{i.first,1}};
}
}
for(auto it:mp){
vector<int> fpow(31);
fpow[0]=1;
for(int i=1;(fpow[i]=fpow[i-1]*it.first)<=2500000;i++);
long long nowa=it.second[0].first,nowm=it.second[0].second;
for(auto news:it.second){
if(news.first==nowa&&news.second==nowm) continue;
long long newa=news.first,newm=news.second;
if(nowm<newm) swap(nowm,newm),swap(nowa,newa);
if((newa-nowa)%fpow[newm]!=0) return false;
}
}
return true;
}
int main(){
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>n>>m;
a.assign(n,vector<int>(m,0)),ans.assign(n,vector<int>(m,0));
for(int i=0;i<n;i++) for(int j=0;j<m;j++){
char ch;cin>>ch;
if(ch>='a'&&ch<='z') a[i][j]=ch-'a'+1;
}
for(int i=0;i<n;i++) for(int j=0;j<m;j++){
char ch;cin>>ch;
if(ch>='a'&&ch<='z') ans[i][j]=ch-'a'+1;
}
if(check(a)) {puts("yes");return 0;}
for(int dir:{0,1,2,3}) if(check(turn(a,dir))) {puts("yes");return 0;}
for(int d1:{0,1,2,3}) for(int d2:{0,1,2,3}) if((d1+8-d2)&1){
vector<int> dirseq={(d1+2)%4,(d2+2)%4,d1,d2};
vector<vector<int>> st=turn(turn(a,d1),d2);
int _=0;
for(;_<4&&!form_check(st);_++,st=turn(st,dirseq[0]),dirseq.push_back(dirseq[0]),dirseq.erase(dirseq.begin()));
if(_==4) continue;
if(check(st)) {puts("yes");return 0;}
vector<pair<int,int>> rlt=build(st,dirseq);
bool flag=true;
for(pair<int,int> it:rlt) if(it.first==-1) flag=false;
if(flag&&check(rlt)) {puts("yes");return 0;}
}
puts("no");
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3604kb
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: 0ms
memory: 3828kb
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: 0ms
memory: 3856kb
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: 1ms
memory: 3604kb
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: 0ms
memory: 3632kb
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: 1ms
memory: 5944kb
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: 0ms
memory: 3592kb
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: 1ms
memory: 5708kb
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: 1ms
memory: 5948kb
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: 1ms
memory: 3628kb
input:
3 3 ... .a. ... ... .a. ...
output:
yes
result:
ok single line: 'yes'
Test #11:
score: 0
Accepted
time: 41ms
memory: 11616kb
input:
500 500 abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...
output:
no
result:
ok single line: 'no'
Test #12:
score: 0
Accepted
time: 45ms
memory: 12460kb
input:
500 500 abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...
output:
no
result:
ok single line: 'no'
Test #13:
score: 0
Accepted
time: 20ms
memory: 12244kb
input:
496 495 oanhdonngaokopboqljdalgpfdeqfelhjchogdmrcaqb.ooogggggicgenlbipaprnfbcrapabfjaemrhdelojgbldirmidgihpjfobgopinddhhmacjcqljgajndcgemiepgipqmdgcqndqadkialgjddpkdfhamldedgrejbbgirpmbeqjc.mbipndabllbjbgrlbrhrcaiphrpogicjdcqeqdhdldpefdekqqihifhagjokepbbceqprongafeqmhbripqceodmfaecpgnaenfjjrjbbabaec...
output:
yes
result:
ok single line: 'yes'
Test #14:
score: 0
Accepted
time: 38ms
memory: 10980kb
input:
367 490 ababbaabbbabbabaabbabbbabababbbabaabbbabbababbabbaaaabbbbaaabbbbababaaaaabbaabaabbbabbbbbababaaabbabaabbaabaabbbabbbbabbbabbabbabbabbbababbabbaaabaabaababaaababaabaabbbbbaaaaabbaaaaabbababaababbaabaabaaaababbbbbaabaaababbabbbbaabaabbabbabbbbaaabbaaababbbaaabbbaaabbbbaabbaaabbbabaaaaaaaaaabaa...
output:
yes
result:
ok single line: 'yes'
Test #15:
score: 0
Accepted
time: 13ms
memory: 14660kb
input:
500 500 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii...
output:
yes
result:
ok single line: 'yes'
Test #16:
score: 0
Accepted
time: 4ms
memory: 14628kb
input:
500 500 tztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztz...
output:
yes
result:
ok single line: 'yes'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
2 4 .xxx ..xx xx.. xx..
output:
no
result:
ok single line: 'no'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
5 8 ........ ........ .aaaaa.. ........ ........ ........ ........ ........ ........ ..aaaaaa
output:
no
result:
ok single line: 'no'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
5 8 ........ ........ .aaaaaa. ........ ........ ........ ........ ........ ........ ...aaaaa
output:
no
result:
ok single line: 'no'
Test #20:
score: 0
Accepted
time: 47ms
memory: 11504kb
input:
500 500 fwizgbybbgxihqejzkgyvdcrgzkfhfktchdilsfgigilfktykliwrykymilrmjjmrlimykyrwilkytkflihifguljdhctkjhgkzfrcdvyfkzfexhxifbbybgziwg...........................................................................................................................................................................
output:
no
result:
ok single line: 'no'
Test #21:
score: 0
Accepted
time: 50ms
memory: 11616kb
input:
500 500 hkmkgolmmlokbyyeohmmvmkhbpgmmkypmbmkmhcqvcbkkkbkbbkkwkkobrrdjkjgelllvclldgcvlddxclxvhvwlglkxsxklglwvhvxlcxddlvcgdllcvlllocaxaarrbokkwkkbbkbkkkbdvzkkmkmbmpykgmgpbhkmvgghoeyybkolgglomkmkh..............................................................................................................
output:
no
result:
ok single line: 'no'
Test #22:
score: 0
Accepted
time: 57ms
memory: 11788kb
input:
500 500 xueftjjjxjyzctkjocmokbkomcojktczyjxjjjtfeuxexumbooocaoljckojectkrketulbzlejoxoloxojelzblutekrktcejokcjloacooobmuxexueftjjjxjyzctkjocmokbkomcojktczyjxjjjtfeuxexumbooocaoljckojectkrketulbzlejhxoloxojelzblutekrktcejokcjloacooobmuxexueftjjjxjyzctkjocmokbkomcojktczyjxjjjtfeuxexumbooocaoljckojectk...
output:
no
result:
ok single line: 'no'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
1 6 ..h... h.....
output:
yes
result:
ok single line: 'yes'
Test #24:
score: 0
Accepted
time: 1ms
memory: 5708kb
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: 0ms
memory: 3860kb
input:
4 2 .e .. .. .. .. .. .. e.
output:
yes
result:
ok single line: 'yes'
Test #26:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
9 10 .......... ......f... .......... .......... ....k.uo.k .......... .......... ......k... .......... ......kfok .........u .........k .......... .......... .......... .......... .......... ..........
output:
yes
result:
ok single line: 'yes'
Test #27:
score: 0
Accepted
time: 0ms
memory: 5640kb
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: 7ms
memory: 7104kb
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: 0ms
memory: 5664kb
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: 17ms
memory: 8632kb
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: 12ms
memory: 7916kb
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: 2ms
memory: 6028kb
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: 19ms
memory: 11396kb
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: 28ms
memory: 11348kb
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: 36ms
memory: 12068kb
input:
500 500 djebdknlnkkkkkdbnmdhjimlkgkmdahblbch.hnlddcehclbekbafhkfahagmhiieah.kkknklcaielnfnendejgaffiekjkkkidmicnkmdgaikmjcgehebhigcjhbmijndemeljdkechaebdnlkmikkkckdgnhaadmnhmjhkfbjdcdkgkkkkiflndcchhgfkcfelnnmdhhgieachdhfghihieikfchenmiemejbkkkikfddi.dnadmfdegklkbghikfkkkmhdmkgnmiifjkbanhkfhdhcabfdn....
output:
yes
result:
ok single line: 'yes'
Test #36:
score: 0
Accepted
time: 15ms
memory: 10976kb
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: 33ms
memory: 11556kb
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: 1ms
memory: 5876kb
input:
10 1 c . . . . . l . c b c l b c . . . . . .
output:
no
result:
ok single line: 'no'
Test #39:
score: 0
Accepted
time: 1ms
memory: 5716kb
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: 1ms
memory: 5648kb
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: 0ms
memory: 3660kb
input:
10 4 .... .... ..wn .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ..wn
output:
yes
result:
ok single line: 'yes'
Test #42:
score: 0
Accepted
time: 1ms
memory: 5648kb
input:
3 5 m.... h.k.. g.... ...mg ....h ....k
output:
no
result:
ok single line: 'no'
Test #43:
score: 0
Accepted
time: 0ms
memory: 6900kb
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: 17ms
memory: 10516kb
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: 2ms
memory: 6084kb
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: 5ms
memory: 6520kb
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: 0ms
memory: 3600kb
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: 29ms
memory: 11396kb
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: 13ms
memory: 11212kb
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: 44ms
memory: 11852kb
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: 42ms
memory: 11848kb
input:
500 500 iah.fbgnlhahdbobnbojkgggafbfnianbnalnlmjbaafjgkmml.hangakeamfgjjhacancngnnnceolibdekjfgaljalhba.ncclbn.jhmohcnmleda.moimmkajenjcjkgmkalnaocafmnehaaaccmlaoggdldbkibomhkbf.gmnabdoahlamnfhfdngiofdnbhcdmbhfgbkiblhammhcngjenlolcchaaclmnjanbahbjkhmaheoolednbogcjmhajmljclfihhakbg.dfcobnagnlldbajkoa...
output:
no
result:
ok single line: 'no'
Test #52:
score: 0
Accepted
time: 48ms
memory: 11844kb
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