QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#524044 | #8679. Tilting Tiles | ucup-team052 | AC ✓ | 40ms | 17824kb | C++23 | 5.2kb | 2024-08-19 09:14:50 | 2024-08-19 09:14:50 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int mod[N * N];
int a[N][N], b[N][N], c[N][N], d[N][N], e[N][N], id[N][N];
char foo[N];
int p[N * N], v1[N * N], v2[N * N], s1[N * N], s2[N * N], nxt[N * N], vis[N * N];
int n, m;
void doit(char op) {
memset(b, 0, sizeof(b));
if (op == 'L') {
for (int i = 1; i <= n; i++) {
int len = 0;
for (int j = 1; j <= m; j++) {
if (a[i][j]) {
b[i][++len] = a[i][j];
}
}
}
}
if (op == 'R') {
for (int i = 1; i <= n; i++) {
int len = m + 1;
for (int j = m; j >= 1; j--) {
if (a[i][j]) {
b[i][--len] = a[i][j];
}
}
}
}
if (op == 'U') {
for (int j = 1; j <= m; j++) {
int len = 0;
for (int i = 1; i <= n; i++) {
if (a[i][j]) {
b[++len][j] = a[i][j];
}
}
}
}
if (op == 'D') {
for (int j = 1; j <= m; j++) {
int len = n + 1;
for (int i = n; i >= 1; i--) {
if (a[i][j]) {
b[--len][j] = a[i][j];
}
}
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
a[i][j] = b[i][j];
}
}
}
const char str[4] = {'L', 'D', 'R', 'U'};
void check() {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (a[i][j] != d[i][j]) {
return;
}
}
}
printf("yes\n");
exit(0);
}
int same() {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if ((a[i][j] == 0) != (d[i][j] == 0)) {
return 0;
}
}
}
return 1;
}
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
scanf("%s", foo + 1);
for (int j = 1; j <= m; j++) {
if (foo[j] != '.') c[i][j] = foo[j] - 'a' + 1;
}
}
for (int i = 1; i <= n; i++) {
scanf("%s", foo + 1);
for (int j = 1; j <= m; j++) {
if (foo[j] != '.') d[i][j] = foo[j] - 'a' + 1;
}
}
memcpy(a, c, sizeof(a)); check();
memcpy(a, c, sizeof(a)); doit('L'); check();
memcpy(a, c, sizeof(a)); doit('D'); check();
memcpy(a, c, sizeof(a)); doit('R'); check();
memcpy(a, c, sizeof(a)); doit('U'); check();
for (int o = 1; o <= 3; o += 2) {
for (int s = 0; s < 4; s++) {
memcpy(a, c, sizeof(a));
int ok = 0, nowd = s;
for (int _ = 1; _ <= 6; _++) {
doit(str[nowd]);
nowd = (nowd + o) % 4;
if (_ >= 2 && same()) {
ok = 1;
break;
}
/*
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
fprintf(stderr, "%d%c", a[i][j], j == m ? '\n' : ' ');
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
fprintf(stderr, "%d%c", d[i][j], j == m ? '\n' : ' ');
}
}
*/
}
if (!ok) continue;
memcpy(e, a, sizeof(e));
int tot = 0;
/*
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
fprintf(stderr, "%d%c", a[i][j], j == m ? '\n' : ' ');
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
fprintf(stderr, "%d%c", d[i][j], j == m ? '\n' : ' ');
}
}
*/
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (a[i][j]) {
++tot;
v1[tot] = a[i][j];
v2[tot] = d[i][j];
a[i][j] = id[i][j] = tot;
}
}
}
for (int _ = 1; _ <= 4; _++) {
doit(str[nowd]);
nowd = (nowd + o) % 4;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (a[i][j]) {
p[id[i][j]] = a[i][j];
}
}
}
/*
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
fprintf(stderr, "%d%c", a[i][j], j == m ? '\n' : ' ');
}
}
*/
memset(mod, -1, sizeof(mod));
memset(vis, 0, sizeof(vis));
int cando = 1;
for (int i = 1; i <= tot; i++) {
if (vis[i]) continue;
int now = i, len = 0;
while (!vis[now]) {
++len;
s1[len] = v1[now];
s2[len] = v2[now];
vis[now] = 1;
now = p[now];
}
for (int j = 2; j <= len; j++) {
int k = nxt[j - 1];
while (k && s2[j] != s2[k + 1]) k = nxt[k];
if (s2[j] == s2[k + 1]) ++k;
nxt[j] = k;
}
/*
for (int j = 1; j <= len; j++) cerr << s1[j] << ' ';
for (int j = 1; j <= len; j++) cerr << s2[j] << ' ';
cerr << '\n';
*/
int fir = 0, sec = 0, k = 0;
for (int j = 1; j <= len * 2 - 1; j++) {
int nowc = (j <= len ? s1[j] : s1[j - len]);
while (k && nowc != s2[k + 1]) k = nxt[k];
if (nowc == s2[k + 1]) ++k;
if (k == len) {
// cerr << "j = " << j << '\n';
if (!fir) fir = j;
else {
sec = j;
break;
}
k = nxt[k];
}
}
if (!fir) {
cando = 0;
break;
}
int nn = len, mm = fir - len;
if (sec) {
nn = sec - fir;
mm = fir - len;
assert(mm < nn);
}
for (int p = 2; p <= nn; p++) {
if (nn % p == 0) {
int tmp = 1;
while (nn % p == 0) {
nn /= p;
tmp *= p;
if (mod[tmp] != -1 && mod[tmp] != mm % tmp) {
cando = 0;
}
mod[tmp] = mm % tmp;
}
}
}
if (!cando) break;
}
if (cando) {
printf("yes\n");
return 0;
}
}
}
printf("no\n");
return 0;
}
/*
4 3
a..
bc.
def
g..
gfd
ce.
b..
a..
*/
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 12000kb
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: 1ms
memory: 11976kb
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: 1ms
memory: 11988kb
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: 0ms
memory: 11936kb
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: 3ms
memory: 11924kb
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: 0ms
memory: 17052kb
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: 3ms
memory: 9940kb
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: 4ms
memory: 17084kb
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: 3ms
memory: 17764kb
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: 2ms
memory: 10364kb
input:
3 3 ... .a. ... ... .a. ...
output:
yes
result:
ok single line: 'yes'
Test #11:
score: 0
Accepted
time: 29ms
memory: 17732kb
input:
500 500 abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...
output:
no
result:
ok single line: 'no'
Test #12:
score: 0
Accepted
time: 36ms
memory: 17748kb
input:
500 500 abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...
output:
no
result:
ok single line: 'no'
Test #13:
score: 0
Accepted
time: 8ms
memory: 17572kb
input:
496 495 oanhdonngaokopboqljdalgpfdeqfelhjchogdmrcaqb.ooogggggicgenlbipaprnfbcrapabfjaemrhdelojgbldirmidgihpjfobgopinddhhmacjcqljgajndcgemiepgipqmdgcqndqadkialgjddpkdfhamldedgrejbbgirpmbeqjc.mbipndabllbjbgrlbrhrcaiphrpogicjdcqeqdhdldpefdekqqihifhagjokepbbceqprongafeqmhbripqceodmfaecpgnaenfjjrjbbabaec...
output:
yes
result:
ok single line: 'yes'
Test #14:
score: 0
Accepted
time: 8ms
memory: 17740kb
input:
367 490 ababbaabbbabbabaabbabbbabababbbabaabbbabbababbabbaaaabbbbaaabbbbababaaaaabbaabaabbbabbbbbababaaabbabaabbaabaabbbabbbbabbbabbabbabbabbbababbabbaaabaabaababaaababaabaabbbbbaaaaabbaaaaabbababaababbaabaabaaaababbbbbaabaaababbabbbbaabaabbabbabbbbaaabbaaababbbaaabbbaaabbbbaabbaaabbbabaaaaaaaaaabaa...
output:
yes
result:
ok single line: 'yes'
Test #15:
score: 0
Accepted
time: 6ms
memory: 17732kb
input:
500 500 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii...
output:
yes
result:
ok single line: 'yes'
Test #16:
score: 0
Accepted
time: 3ms
memory: 17744kb
input:
500 500 tztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztztz...
output:
yes
result:
ok single line: 'yes'
Test #17:
score: 0
Accepted
time: 3ms
memory: 12024kb
input:
2 4 .xxx ..xx xx.. xx..
output:
no
result:
ok single line: 'no'
Test #18:
score: 0
Accepted
time: 3ms
memory: 11944kb
input:
5 8 ........ ........ .aaaaa.. ........ ........ ........ ........ ........ ........ ..aaaaaa
output:
no
result:
ok single line: 'no'
Test #19:
score: 0
Accepted
time: 0ms
memory: 11944kb
input:
5 8 ........ ........ .aaaaaa. ........ ........ ........ ........ ........ ........ ...aaaaa
output:
no
result:
ok single line: 'no'
Test #20:
score: 0
Accepted
time: 40ms
memory: 17760kb
input:
500 500 fwizgbybbgxihqejzkgyvdcrgzkfhfktchdilsfgigilfktykliwrykymilrmjjmrlimykyrwilkytkflihifguljdhctkjhgkzfrcdvyfkzfexhxifbbybgziwg...........................................................................................................................................................................
output:
no
result:
ok single line: 'no'
Test #21:
score: 0
Accepted
time: 33ms
memory: 16816kb
input:
500 500 hkmkgolmmlokbyyeohmmvmkhbpgmmkypmbmkmhcqvcbkkkbkbbkkwkkobrrdjkjgelllvclldgcvlddxclxvhvwlglkxsxklglwvhvxlcxddlvcgdllcvlllocaxaarrbokkwkkbbkbkkkbdvzkkmkmbmpykgmgpbhkmvgghoeyybkolgglomkmkh..............................................................................................................
output:
no
result:
ok single line: 'no'
Test #22:
score: 0
Accepted
time: 30ms
memory: 17692kb
input:
500 500 xueftjjjxjyzctkjocmokbkomcojktczyjxjjjtfeuxexumbooocaoljckojectkrketulbzlejoxoloxojelzblutekrktcejokcjloacooobmuxexueftjjjxjyzctkjocmokbkomcojktczyjxjjjtfeuxexumbooocaoljckojectkrketulbzlejhxoloxojelzblutekrktcejokcjloacooobmuxexueftjjjxjyzctkjocmokbkomcojktczyjxjjjtfeuxexumbooocaoljckojectk...
output:
no
result:
ok single line: 'no'
Test #23:
score: 0
Accepted
time: 1ms
memory: 10412kb
input:
1 6 ..h... h.....
output:
yes
result:
ok single line: 'yes'
Test #24:
score: 0
Accepted
time: 0ms
memory: 16728kb
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: 4ms
memory: 16984kb
input:
4 2 .e .. .. .. .. .. .. e.
output:
yes
result:
ok single line: 'yes'
Test #26:
score: 0
Accepted
time: 0ms
memory: 17540kb
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: 17700kb
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: 6ms
memory: 17740kb
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: 5ms
memory: 17700kb
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: 9ms
memory: 17724kb
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: 9ms
memory: 17404kb
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: 16752kb
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: 8ms
memory: 17696kb
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: 11ms
memory: 17680kb
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: 11ms
memory: 17824kb
input:
500 500 djebdknlnkkkkkdbnmdhjimlkgkmdahblbch.hnlddcehclbekbafhkfahagmhiieah.kkknklcaielnfnendejgaffiekjkkkidmicnkmdgaikmjcgehebhigcjhbmijndemeljdkechaebdnlkmikkkckdgnhaadmnhmjhkfbjdcdkgkkkkiflndcchhgfkcfelnnmdhhgieachdhfghihieikfchenmiemejbkkkikfddi.dnadmfdegklkbghikfkkkmhdmkgnmiifjkbanhkfhdhcabfdn....
output:
yes
result:
ok single line: 'yes'
Test #36:
score: 0
Accepted
time: 23ms
memory: 17028kb
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: 12ms
memory: 16780kb
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: 3ms
memory: 17404kb
input:
10 1 c . . . . . l . c b c l b c . . . . . .
output:
no
result:
ok single line: 'no'
Test #39:
score: 0
Accepted
time: 4ms
memory: 16756kb
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: 0ms
memory: 17228kb
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: 1ms
memory: 10352kb
input:
10 4 .... .... ..wn .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ..wn
output:
yes
result:
ok single line: 'yes'
Test #42:
score: 0
Accepted
time: 3ms
memory: 17032kb
input:
3 5 m.... h.k.. g.... ...mg ....h ....k
output:
no
result:
ok single line: 'no'
Test #43:
score: 0
Accepted
time: 4ms
memory: 17072kb
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: 9ms
memory: 17764kb
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: 0ms
memory: 17744kb
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: 0ms
memory: 17176kb
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: 1ms
memory: 11996kb
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: 17ms
memory: 17752kb
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: 24ms
memory: 17540kb
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: 32ms
memory: 17740kb
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: 32ms
memory: 17084kb
input:
500 500 iah.fbgnlhahdbobnbojkgggafbfnianbnalnlmjbaafjgkmml.hangakeamfgjjhacancngnnnceolibdekjfgaljalhba.ncclbn.jhmohcnmleda.moimmkajenjcjkgmkalnaocafmnehaaaccmlaoggdldbkibomhkbf.gmnabdoahlamnfhfdngiofdnbhcdmbhfgbkiblhammhcngjenlolcchaaclmnjanbahbjkhmaheoolednbogcjmhajmljclfihhakbg.dfcobnagnlldbajkoa...
output:
no
result:
ok single line: 'no'
Test #52:
score: 0
Accepted
time: 27ms
memory: 16892kb
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